LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI start event - does it exist

Hello,

 

In the initialization phase (please see the screenshot below) I want that all 3 event cases be executed once VI starts.

Is it possible ?

Or I should add additional frame and put there the code from these 3 cases ?

 

Thanks in advance.

 

Pavel.

 

Initialization issue.JPG

0 Kudos
Message 1 of 17
(5,496 Views)

There is no 'VI Start' event...your code just runs when the VI starts so having an event for it doesn't make sense!

 

- I would discourage you from using the flat sequence structure - it is always better to use a state machine instead (with an 'initialise' case, then you would probably have a 'setup' and a 'run' case). Because you have data flow from your while loop to your for loop - the sequence structure actually serves no purpose.

- You could use the 'Value Change (signalling)' property node on one of the controls in each event structure to generate each event

- You could use a 'User Event' to generate an event programmatically (which could contain your 'initialise' code)

 

(Another note - rather than wire your 'start' button to the stop of the while loop, you could create an event case for the 'start' button and wire a true to the while loop stop terminal - this stops you from needing the timeout)


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 17
(5,486 Views)

Thank Sam,

 

I'll implement your suggestions in the final version of VI.

But concerning this one, I din't properly understand how to initialize values without any actions from user.

To be more clear, I want that once VI starts, the values X, Y, Z take values of X0, Y0, Z0 respectively, what is actually not the case (please see the 1st screenshot).

I've added "Value Change (signalling)" into timeout case (please, see the 2nd screenshot), but it didn't help.

 

Initialization issue (2) - FP.JPG

 

Initialization issue (2) - BD.JPG

0 Kudos
Message 3 of 17
(5,463 Views)

Flat sequence removed

0 Kudos
Message 4 of 17
(5,452 Views)
Do you have an Event Case for X, Y and Z? They are indicators...so the user cannot change their value so it will never change. You probably want X0, Y0 and Z0.

With your current implementation - it will update the values in every timeout - you might want to put a case structure around it (perhaps with first call?).

Also, if you wire a 0 to the timeout in the first iteration, and then 100 in following iterations - the timeout case will execute immediately instead of waiting 100ms.

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 17
(5,445 Views)

No, I have no cases for X, Y, Z.

Except timeout I have 3 event cases:

  • X0, X1, step X
  • Y0, Y1, step Y
  • Z0, Z1, step Z

With your current implementation - it will update the values in every timeout - you might want to put a case structure around it (perhaps with first call?)

"it will update the values ... " You mean X, Y, Z ?

Yes, I thaught that 3 event cases be executed automatically once VI starts, so X0, Y0, Z0 take theirs values from corresponding controls. And then until user clicks on "START" button, the timeout case should be executed repeattedly, where X, Y, Z are assigned from X0, Y0, Z0. But such scenario doesn't work.

 

Also, if you wire a 0 to the timeout in the first iteration, and then 100 in following iterations - the timeout case will execute immediately instead of waiting 100ms.

I've implemented this (at least as I understood it) - please see the screenshot below.

 

I've also added mouse event to the event case (to the X-related for the moment) ... well the initial assignment could be done with mous movement, but it requires minor user action nevertheless

 

Initialization issue (3) - BD.JPG

0 Kudos
Message 6 of 17
(5,435 Views)
The Value (signalling) property generates the same event as if you had entered a new value manually to that control - you can use this to cause a value change event to occur programmatically. You need to generate the value change event for one of the controls in your value change event cases - e.g. X0, X1 or Step X. If you had a value (signalling) property for each of X0, Y0 and Z0, then it would generate a value change event for each of those controls and your 3 cases would execute.

LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 7 of 17
(5,415 Views)

I'm not sure that I correctly implemented your suggestions, but now it works.

I've made 2 modifications (please, see the screenshot below):

  • added assign to X, Y, Z Signalling property in each of 3 event cases (blue encirclement)
  • added flat sequence structure, where I assign to X0, Y0, Z0 Signal properties theirs proper values

Can you confirm that you meant these modifs.

 

Thanks

 

 

 

 

Initialization issue (3a) - BD.JPG

0 Kudos
Message 8 of 17
(5,399 Views)

Pavel,

 

     Forgive me if I've entirely missed the point, but I don't "get" what you are trying to do, nor do I understand why you are making so much work for yourself.

 

     The Snippet below does the following (I just used X, instead of X, Y, and Z, for simplicity).  It's goal is to step X from X0 to X1 in steps of Step X, and do to this every 100 msec (hence the value in the TimeOut, which I'm using as my "Clock").  The following "Rules" are in effect:

  • X always starts from X0.
  • The program stops if X is greater than or equal to X1.
  • If any of X0, X1, or X Step changes, the process starts over, with X starting at X0 again in steps of Step X until X >= X1.

There are no Case statements, no Frames, nothing more complicated than shift registers and a little logic.  There are also no "Value Signalling" Events ...

 

X Stepper.png

Bob Schor

Message 9 of 17
(5,384 Views)

Bob,

 

Your snippet looks much more "elegant" that mine.

My scenario is a little bit different ...

1. VI starts ... and X,Y, Z take immediately their starting values, i.e. X0, Y0, Z0

2. User do modifications (X0, X1, step X, Y0, etc.)

3. User run loops (click "START" button") ... and during running user can't do any modifications: loops cannot be interrupted

 

But Ok, I'll try adapt it to my 3-loop (X, Y, Z) case.

 

Thanks !

 

Pavel

0 Kudos
Message 10 of 17
(5,360 Views)