From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Certification

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue based UI Event Handler Pattern (CLD)

Hi, everybody:

 

I am trying to get a better understanding of the Queue based UI Event Handler pattern in CLD exam. So I made the attached small LabVIEW program in which 3 buttons(State 0, State 1, State 2) are the 'switches' of 3 LED lights (S0, S1, S2), respectively. After comparing with the Queue based UI Event Handler pattern in NI's slide, I got some questions at the following points:

 

(1) There are six items(Initialize, Waiting for Event, State 0, State 1, State 2 and Stop) in the Enum constant in my program. To make this program use standard Queue based UI Event Handler pattern, should I only use 3 cases(Initialize, Waiting for Event, Stop) in the case structure and put 4 events(State 0, State 1, State 2 and Stop) under the case of 'Waiting for Event' ? Is what I coded a standard Queue based UI Event Handler pattern?

 

(2) In the attached screenshot of Queue based UI Event Handler pattern in NI's slide, I found 'Start' is wired with 'Enqueue Element.vi'. Why is that? Should there be a 'Start' Case in the case structure?

 

(3) In my program, I wired 'Waiting for Event' with 'Enqueue Element.vi' in all events except 'Stop' event. Should I wire 'State 0', 'State 1', 'State 2' with 'Enqueue Element.vi' in their corresponding events, just like my second question in NI's slide?

 

BTW, I didn't find the exact Queue based UI Event Handler pattern in LabVIEW 2011, Should we code it by ourselves in the real CLD exam?

 

Thanks a lot in advance!

 

Chuan

Download All
0 Kudos
Message 1 of 3
(6,520 Views)

Any ideas?

0 Kudos
Message 2 of 3
(6,482 Views)
@Chuan wrote:

Hi, everybody:

 

I am trying to get a better understanding of the Queue based UI Event Handler pattern in CLD exam. So I made the attached small LabVIEW program in which 3 buttons(State 0, State 1, State 2) are the 'switches' of 3 LED lights (S0, S1, S2), respectively. After comparing with the Queue based UI Event Handler pattern in NI's slide, I got some questions at the following points:

 

(1) There are six items(Initialize, Waiting for Event, State 0, State 1, State 2 and Stop) in the Enum constant in my program. To make this program use standard Queue based UI Event Handler pattern, should I only use 3 cases(Initialize, Waiting for Event, Stop) in the case structure and put 4 events(State 0, State 1, State 2 and Stop) under the case of 'Waiting for Event' ? Is what I coded a standard Queue based UI Event Handler pattern?

What exactly are you trying to do with this program?  Just using it to show a basic pattern for review? 

Seems like you are trying to use Queues, a Case Structure, and Events all in one loop.  Be careful not to try to be so advanced for this test.  I still can't seem to figure out what the question you are trying ask is, but reply and we'll see if we can figure out an answer.  You can put as many "states" in an Enum as you want but just not use them all during the program.  I use fillers sometimes "just in case" I need to use it.  Obviously, don't do this for a real program. 

(2) In the attached screenshot of Queue based UI Event Handler pattern in NI's slide, I found 'Start' is wired with 'Enqueue Element.vi'. Why is that? Should there be a 'Start' Case in the case structure?

 Your code is your code.  This is just an example of the way that you could do it if you wanted to.  You need to read the requirements document to determine exactly the way to Initialize and Start and whatever else your program.  Typically, I've seen the following included in software using this structure:  Initialize, Start, Run, Stop, Update Settings, Exit...and so on.

 

(3) In my program, I wired 'Waiting for Event' with 'Enqueue Element.vi' in all events except 'Stop' event. Should I wire 'State 0', 'State 1', 'State 2' with 'Enqueue Element.vi' in their corresponding events, just like my second question in NI's slide?

 Well, you never ended up using the Initialize case.  You need to Initialize outside the loop in your program.  Again, try to explain your design more.  It seems like what you have done is right, but I'm not sure what all you are trying to accomplish.

 

BTW, I didn't find the exact Queue based UI Event Handler pattern in LabVIEW 2011, Should we code it by ourselves in the real CLD exam?

All code on the CLD needs to be your own.  Templates are just there as a starter for people who are not familiar with them.  If you want to take the CLD, you should be at the point where you don't need the templates to do the work for you. 

Thanks a lot in advance!

 

Chuan


See my responses above.  Best of luck.

 

The pattern you have used in your program is *technically* fine, but in all the code I wrote for the CLD and in most of the examples I saw, everything was just a state machine with a enum driver.  Be careful trying to violate the norm on this as you will likely run into more problems than solutions.  You could also encapsulate your Queue into an FGV, which would modularize the code and look a little neater.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 3 of 3
(6,460 Views)