The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Event Structures and Val(Sgnl)

SercoSteveB
Active Participant

Both Event Structures, shown below, have only one defined event (the one shown).  What is the value of Numeric Value Out following exection of the VI?

 ValSgnl#2.png

 

a) 0

b) 1

c) 2

d) Undefined (The VI never completes)

Comments
BenoitP.
Member

The propriety node change the value of the boolean indicator to False and generate a value change event !

The two events structures were wating for the "Stop" : Value change event during an infinity time (no time out)

However only the first one can start because the second one is still waiting 2 informations : error and a numeric value.

First Structure handle the "Stop" : Value change event and transfert error value and 0+1 as numeric value to the second one.

Now the second one can handle the "Stop" : Value change event and transfert 1+1 to the Numeric Value Out indicator

(ans c)

YogeshShivarudrappa
Member

Ans is 2.

Very clean explaination BenoitP.

Also nice questions SercoSteveB

Please continue to post such q's and keep increasing the difficulty level. I am planing to take up CLAD this month.

dfjuggler
Member

I believe that d) would be the correct answer.

None of the event structures start execution when the Val(Sgnl) generates the value chage event.

For the VI to complete execution, a user would have to press stop twice. In that case, Numeric Value Out would certainly be 2.

EDIT: It seems that it's d) but not for the reason I thought. The Val(Sgnl) property node is generating events that are not handled by the event structures (because they are generated for a refnum control named stop 2). Additionally, the user only needs to press stop once for the VI to terminate.

If the BD looked like this:

Event structures and data flow - what I understood.png

then answer c) would be correct.

What I still haven't understood fully is how events seem to be queued and how one stop value change event can be handled by more than one event stucture with this kind of data flow.

To understand it better I built this other diagram:

Event structures, data flow - experiment queueing events.png

The idea was to have Numeric Value Out present the number of clicks done on Add Val(Sgnl) Event but this BD freezes. To my surprise, since I expected the Val(Sgnl) on stop 2 to be ignored by the first loop (the two other event cases are shown in this next picture, though I think you should be able to drag and drop the snipped onto your BD).

Event structures and data flow - experiment view 2.png

mini09
Active Participant

Insted of getting Bool (Strict) in property node i just get it as Bool? what would be the mistake.

dfjuggler
Member

gnshmrthy I think that happens because your stop button's mechanical action is latched. If, on the front panel you right-click on your stop button and change to a switched mechanical action, your property node will change to bool(strict) and it will accept a boolean instead of a variant.

mini09
Active Participant

Yipee!!! finally i got the program. the ans in C. thanks Pearson.

RobCole
Active Participant

This is another ambiguous question with the answer based on how the test-taker interprets the language.

Less ambiguity and more testing of LabVIEW knowledge!

     Rob

Not applicable

RaúlRodríguezPearson wrote:


                       

What I still haven't understood fully is how events seem to be queued and how one stop value change event can be handled by more than one event stucture with this kind of data flow.

I agree, this runtime behavior is confusing/counterintuitive. The explanation can be found in the LabVIEW help topic "Using Events in LabVIEW" under the subtopic "Static Event Registration":

"When you run a VI, LabVIEW sets that top-level VI and the hierarchy of subVIs the VI calls on its block diagram to an execution state called reserved. You cannot edit a VI or click the Run button while the VI is in the reserved state because the VI can be called as a subVI at any time while its parent VI runs. When LabVIEW sets a VI to the reserved state, it automatically registers the events you statically configured in all Event structures on the block diagram of that VI. When the top-level VI finishes running, LabVIEW sets it and its subVI hierarchy to the idle execution state and automatically unregisters the events."

Note the underlined text that says ALL statically configured events are registered at the moment the VI is executed (i.e., when the VI enteres the reserved state). In other words, static event registration DOES NOT occur when control reaches the entry point of the EVENT STRUCTURE. This is counterintuitive, IMHO.

praveenkumarnagarajan
Member

what is the correct answer c or d???

crossrulz
Knight of NI

I think what Steve was aiming for was C.  But the built-in snippet tool doesn't handle local variables and property nodes properly.  So if you go strictly by the snippet, it is D.

Yes another reason I use the Code Capture Tool.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
ramesh44
Member

From the block diagram observation I am able to make out that the control reference which is wired to the property node [Bool(strict)] is Stop2 and its not shown in the block diagram it means the VI “Stop”: Value Change event will not be occurred so it will not be complete the execution. Please correct me if I am wrong

crossrulz
Knight of NI

ramesh44 wrote:


                       

From the block diagram observation I am able to make out that the control reference which is wired to the property node [Bool(strict)] is Stop2 and its not shown in the block diagram it means the VI “Stop”: Value Change event will not be occurred so it will not be complete the execution. Please correct me if I am wrong


                   

Just read my comment right above yours...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
skian
Member

C