LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help understanding timeout feature of event case structure

After opening a file or creating a variable within one state. Is it possible to pass that data to another state?

0 Kudos
Message 11 of 19
(1,407 Views)

Hi Damian,

 


@damianhoward wrote:
Is it possible to pass that data to another state?

Yes, sure! Use shift registers…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 19
(1,399 Views)

It is illustrated in my example(s)

Greets, Dave
0 Kudos
Message 13 of 19
(1,389 Views)

@daveTW

 


@daveTW wrote:

It is illustrated in my example(s)


Unfortunately, I am using labview 2017 and I am unable to see your examples. As well as a few of the others.

0 Kudos
Message 14 of 19
(1,366 Views)

 @GerdW

 

I have followed your advice, putting the different functions I plan to use in different loops. I am still running into issues though. Could you please take a look at my code and give me feedback? The top loop is for load control of a linear actuator and load cell. The middle loop is the state machine and the bottom loop is the querying of device output and writing to a file.

 

If there are any mistakes please point them out. My current issue is I cannot get past the idle stage of the state machine. When I click test active area. nothing seems to happen. I added the event structure to try and make it update based on the button presses but I can only seem to get to state 54 degree if the button is clicked when I start the program.

0 Kudos
Message 15 of 19
(1,364 Views)

All of your Booleans that currently do something (Load Control, Record Active Area, Record 360) are outside any While Loops, meaning they will get read a single time when the VI starts and never again. You need to put them inside their respective loops if you want to continuously read them. That's probably the biggest thing keeping your code from executing as intended, probably.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

Message 16 of 19
(1,361 Views)

@damianhoward 

 

I think the program architecture that you're using is not suitable. Since you have many parallel loop, did you try to use Producer/Consumer (Events) Design Pattern where you can have one producer loop which it keep the controls user interface responsive to your desired mode such as 'idle mode' like you have mentioned ?

In this way, you will just need to click your Boolean control button, then a message string 'idle mode' +  a cluster of data that you want to configure will enqueue to another parallel loop which is consumer loop and dequeue from the channel wire (thick pink colour line) while the program is running. Channel Wire allow you to simplify the programming involved in data transfer between parallel loops. 

 

Be aware that you should keep every controls inside the while loop especially when you want to update a new configurations while running your program. Because once program run, a while loop will not detect any changes that happen outside its loop. 

 

Link to study Producer/Consumer (Events) Design Pattern:

https://www.ni.com/en/support/documentation/supplemental/21/producer-consumer-architecture-in-labvie...

 

I have attached the zipped producer/ consumer VI that I have done before when I want to acquire data from accelerometer but at the same time I want it able to do setting for my new configurations and change to idle mode when I'm not acquiring anything.
Kindly open the trial 2 VI in the 2 accelerometer file to have a look, the another VI is a general Producer/consumer VI only.

sample 2.PNG

 

Message 17 of 19
(1,343 Views)

@damianhoward wrote:

@daveTW

 



Unfortunately, I am using labview 2017 and I am unable to see your examples. As well as a few of the others.


So this is the converted Version.

Greets, Dave
0 Kudos
Message 18 of 19
(1,320 Views)

Thank you Wai and Dave for the producer/consumer examples. I am going to look over them the next couple of days and see how I can incorporate their structure in my code. I may some have some questions so I'd appreciate it if you guys look in on this thread from time to time.

 

I'm trying to get some more advice on my current design please see the attached.My question is, I have defined a function/process in the top loop. I was under the impression that labview can run multiple loops in parallel. However, when I run this vi the top loop doesn't run when the value of the boolean(load control) changes. Can someone help me understand why? Is the fix to put both the SM loop and the load control loop in one big loop? Last question. Say I wanted the following functionality:

1. Every time the state machine executes Idle the user specifies a new file for the serial data to be read into

2. Through out the execution of the state machine the data is recorded into the file the user specified

3. When returning to idle/right before idle the file is closed and the user is automatically prompted to open another file for a new run.

 

How would I achieve this? Is this something I should accomplish with the addition of another loop? and if so how do I ensure all the parallel loops run while the state machine is running?

0 Kudos
Message 19 of 19
(1,293 Views)