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 KB
OK 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
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 -
How to implement session varibles and how to use it
how to implement session varibles and how to use it.ple help me
Please see the below blog, Hope it helps!!!
http://obieetraining11.blogspot.com/2012/06/create-initialization-block-for-session.html -
Numbers into textfield using boolean buttons and case structure?
Hi!
I'm very new to these forums, and to LabVIEW in general. I'm currently trying to implement a calculator-ish, but without the operations (+ - * /).
I have 10 boolean buttons, named 0-9, and with these I want to basically write a sequence of numbers into a textfield. I've managed to solve the problem using an Event structure, but now i'd like to achieve the same result using a Case structure instead. The problem is that I can't identify which button has been pressed, so I can't make the program go to the correct case (0 to 9). Is there any simple solution to this that you guys could help me with? Maybe a property node that's generic for every button? I dont know
Anyways, I'm attaching a simplified version of what I'm trying to achieve, withouh the code I don't know how to write obviously.
Thanks for your help in advance!
/Sebastian
Solved!
Go to Solution.
Attachments:
help.vi 12 KBHere is a way to do it: bundle the boolean values into an array, turn that into an 8 bit number and wire that to a case structure with a boolean radix
Message Edited by jmcbee on 03-31-2009 02:29 PM
CLA, CLED, CTD,CPI, LabVIEW Champion
Platinum Alliance Partner
Senior Engineer
Using LV 2013, 2012
Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
Attachments:
helpMOD.PNG 13 KB
helpMOD 80.vi 20 KB -
How to read shared variables inside event structure ?
Hi,
I have a problem that my shared variables do not update inside event structure. The program(s) I am trying to get working is seen in the attached screenshot. It works as follows:
0. I start the vi that is unsquared.
1. I write a string to a shared variable using vi in red square. I make sure that its updated using write-wait-read.
2. I run the other vi (blue square), this changes the boolean shared variable.
The unsquared vi has been running the whole time, it has event structure bind to boolean shared variable change (the one in blue vi). After I have runned the blue vi, the unsquared vi should change the indicator values to match the ones in red vi. However I have to start the blue vi multiple times to get it to change, sometimes even 6 times.
Also, when I change the value in red vi to a third value and start blue vi multiple times, the unsquared vi shows all the variables. I.e. I put "cat" to red then start red, put "mouse" to red then start red,... and then start clicking blue... Unsqured shows cat, mouse,..., dog (dog is the default).
How can I force the shared variable to update inside event sructure. I want the current value of the variable, not some historical values.
Attachments:
Screenshot-5.png 108 KBFound the buffering... disabling it solved the problem... thanks.
FYI, there is another solution that I just found out... attached. Adding timeout to the event structure and the variable read outside the event structure... This makes the shared variable strings (one that is read outside and the otherone that is read inside) different.
Could someone explain why the variables are in different state even if they are used in the same place and looped with 10ms intervals?
Juha
Attachments:
Screenshot-6.png 110 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 -
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 -
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 -
How to trigger value change in event structure
Hii everyone, as the title, how should I trigger the value change event to pop up a message.. below is my connection..
I want to trigger the event structure to pop up the sub-vi, when the flame and led are TRUE state... I using property node but still the event structure not able to execute.. How should I connect? Thank you very much...
Solved!
Go to Solution.There are several ways you can do it. First you have to configure your sub-vi so that it does whatever you want when it runs (in the vi properties, top most window for example) and to make sure that it closes completely when finished (when clicking the "OK" button for example).
You than need to make an asynchronous call to the sub-vi. There are several ways to do it. My favorite one is shown below. You go in the "Application control" sub-palette and select Static VI reference. I like this approach because it keeps track of the sub-vi path for you, as long as the sub-vi is in the same project. You then drag the sub-vi onto the empty square that will changes to your sub-vi icon. You then connect to an invoke node from the same sub-palette and select run VI. Set "Wait Until Done" to false and the main VI will keep running after starting the Sub vi. Set "Auto Dispose Ref" is the easiest way to go. Otherwise you have to keep track of the sub-vi reference and close it yourself when you're done.
Marc Dubois
HaroTek LLC
www.harotek.com -
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 -
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 advanceHi!
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 -
How to stop While Loop in Event Structure with same button?
Hello,
I have a problem. I want to use one control to activate an event in a event structure, and the same control to terminate a while loop in that event.
It is possible to use 2 controls to do this, but I need it to be only one.
Thank you
Message Edited by Heinen on 02-19-2009 06:16 AM
Message Edited by Heinen on 02-19-2009 06:20 AM
The Enrichment Center is required to remind you that you will be baked, and then there will be cake.
Solved!
Go to Solution.Hello,
I have a bit different problem.
I have a tab control, with several buttons on different pages.
In the current situation, we can talk about two pages, where one page ("Settings") in the Image, has a START and EXIT button, while second page ("Wait") has an EXIT button.
In a while loop, I have event structure, which handles events of the START and EXIT buttons of the Settings page. This is fine. But I also want to control the Exit button of the Wait page.
The control works like this:
When I click on Start in the Settings page, the front panel shows Wait page and attempts to connect to a datasocket server on the remote computer. If the user wants to stop this process, he can click on Exit on Wait page too. But, this doesn't give any immediate effect. On the even of Start button, the front panel is not locked, so the user can actually click the Exit button on the next page when it's visible. But it's of no immediate effect. Means, what the LabVIEW does is, finishes the execution of event in Start button's click, and while this executes, it doesn't consider the Exit button's refreshed value (shown in Red circle in the block diagram).
Simple question: Is there any way to check the updated (latest/live) value of a control during some event's execution? Or if I write an Event "Value Changed" for the Exit button and pass it to some variable. Is it the only solution?
Thanks ahead.
Vaibhav
Attachments:
terminate event_diagram.jpg 200 KB
terminate event_front_1.jpg 63 KB
terminate event_front_2.jpg 63 KB -
How to implement Custom Authentication and Authorization in Oracle SOA 11g
Can anyone please tell me, how to implement Custom Authentication in Oracle SOA 11g ?
Because in Oracle SOA 10.1.3.4 , i have implemented this custom authentication and authorization by implementing BPMAuthenticationService, BPMAuthorizationService, BPMIdentityService to verify againt my database systems.
implementation classes like the mentioned below
1).
public class SampleAuthenticationService extends SampleServiceBase implements BPMAuthenticationService {
2).
public class SampleAuthorizationService extends SampleServiceBase implements BPMAuthorizationService {
3).
public class SampleIdentityService extends SampleServiceBase implements BPMIdentityService {
Please help me to implement the authentication and authorization in Oracle SOA 11g .
thanks in advanceTo start with please go through following document
http://docs.oracle.com/cd/E21764_01/integration.1111/e10231/adptr_jms.htm
http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm
Regards
Arpit -
How to implement row span and column span in JTable.
Hi,
How do we implement Col span and row span in JTable as in Html.
Kindly help.
Thank YouAlthough I suppose you could extend JTable to support column and row spans, this would involve a lot of of work and quite a few hacks. I think you will be better off either creating a new custom JComponent with an appropriate model for this purpose or using an existing solution such as [JIDE Grids|http://www.jidesoft.com/products/grids.htm] which includes a CellSpanTable.
-
How to implement boolean control via network
Hi,
I am developing an application by using LabVIEW 8.2 and RealTime. There is a host PC connecting to a PXI
through network cable. Application VIs are running at PXI and GUi is running at host PC. My problem is
When I config a boolean control as "Latch when release" mechanism, pass it to a shared network variable
and then to a boolean control at PXI. "Latch when release" mechanism seems not run very well. Most of the
time, no action when I press the boolean control button in my GUI. It seems that shared network variable
could not act as "Latch when release" mechanism. I checked some examples from NI. Most of examples set
the boolean control button mechanism as "Switch when press" and manually switch it status later on. I have
a bunch of such boolean control buttons in my GUI. It will be hard to handle every of them in this way.
I'd like to know whether there is an easier solution for this.
Thanks
JasonHi Jason,
How are you passing the shared variable to the Boolean control in PXI VI?
Here is something to try out.
--Configure the Boolean controls on both systems to "latch until released".
--Create the shared variable (network-published) on the host PC and wire the output of the Boolean control to it.
--On the remote system, bind the Boolean control to the shared variable on the host PC. To bind to the shared variable, right click the Boolean control
and select properties. Then select the "Data Binding" tab in the property window. Set the "data Binding selection" option to "Shared Variable Engine
(NI-PSP)" and browse for the path to the shared variable created on the host PC.
--With this setting, whenever the Boolean control on the remote system (PXI) reads a true value, it stays true until the value is read by LabVIEW and
goes back to the initial (false) state.
Checkout the attached sample LabVIEW project.
Tun
Message Edited by Tunde A on 12-12-2006 05:27 PM
Attachments:
Boolean Shared Var.zip 18 KB
Maybe you are looking for
-
How to delete black space under my page..
though the pages seem to be same size, in some of them i've got some black space under them and i cant take it away with the layout buttons what can I do? thanks
-
Yeah, so this is what happened. I had an old iPod nano, and then my computer crashed and deleted eveything. Then, I got a new iPod, and I want to put songs that I had on a CD that I already had on iTunes before my computer crashed onto my new iPod, b
-
Indesign cs6 trial start problem
I downloaded all files for the trial cs6, but could not see how to get the program running. I found the indesignservercs6.exe in my program files/adobe but clicking it does nothing. How do I get this running?
-
RE: Windows Media Player
Hello, I have found that my Windows Media Player is downloading photographs from sites that I visit. It keeps them and uploads them from an unknown device. I am thinking that this unknown device is the Internet or specific sites that I visit while br
-
Relation between storage loc and workcenter/resource
Dear Gurus My client wants that whatever materials (fert) coming out from a particular workcenter/resource should be posted to a particular storage location.And that the system should propose the storage location while posting of goods.Can a storage