LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updting loop inputs

Solved!
Go to solution

 Hi friends!

 

 I'm getting almos crazy here with a problem that surely is simple to solve:

 

 The main VI has an inditator to show the operator a certain value of the process. In the background ther is a state machine running the process control. To let things simple, lets say there are 3 states: Calculation, Actuation and Waiting Response. The whole structure should work like this:

 #1 In the calculation state read the process value and determine de desired output

 #2 In the Actuation state the output is applied to the process

 #3 In the Waiting Response state the machine awaits until the previously applied output affects the process

 

 As the indicator is updated continuously, it is connected an acquisition VI in the most external loop. The problem is that the value used in the Calculation step is just the same connected to this indicator. So, as I could debug, just after the machine leaves the Calculatoin state, the data acquisiton hardware deliver a new reading of the process, an it keeps doing this continuously. In that way, when the machine comes back to the Calculation state, several external loop cycles after, the value avaiable in the tunnel us an old one, the one that arrived just after leaving Calculation state, not the last one the acquisition hardwre read.

 It is important that the acquisition VI stays in the outer loop, in order to get the indicator updated. The number of states and their functionality is also quite imutable. It seems to me that all my problems would desapear if the case structure used in the state machine could use hust the last value received from the hardware.

 

I'm awfull sorry for the los text, but does anyone have an idea of what could be don in this case?

 

 Thanks so much

 

 Leo

Message 1 of 15
(3,554 Views)
Perhaps you can update the indicator with a property node to ensure it has the latest value? Or am I missing something to why that can't be done?
0 Kudos
Message 2 of 15
(3,541 Views)

You could use notifiers. Send a notification in your hardware loop.

Use a wait for notification with timeout 0 to get the latest value.

This will look similar to the producer-consumer design pattern, if you are familiar with this.

 

Felix

0 Kudos
Message 3 of 15
(3,536 Views)

If you are using a shift register in the loop where the data acq is going on, and the new data is overwriting the old acquisition data using a bundle by name to write the new data into the cluster, then the newest data should be available whenever the other functions need to run.  The attached example is crude, but does what I was trying to say.  If that works...then great.

 

 

State machine goes in the top loop...might add a third loop for the events creator.

 

 

Good luck.

 

Hummer1

0 Kudos
Message 4 of 15
(3,527 Views)

 Thank you for your reply, zenthoef.

 

 My problem is not ensuring the indicator has the latest vallue, but the case structure. In fact, the indicator is updated online, so it has always the most recent value.

0 Kudos
Message 5 of 15
(3,513 Views)

 Dear Felix,

 

 I guess that's an intersting point of view. I'm afraid that with a wait for notification the case structure will still reading only the the first, thus the oldest, value. I'll try to deveop something with this suggestion and report you back as soon as I have some results.

 

 Thanks

 Leo

0 Kudos
Message 6 of 15
(3,508 Views)

Thank you Hammer1.

 

 I'm not in my PC right now, so it may take some time for me to feed you bck about your example.

 

Leo

0 Kudos
Message 7 of 15
(3,503 Views)

Sorry, my first example doesn't work.  Here is an example using a 1 element queue that works like I think you want it to.

 

Hummer1

0 Kudos
Message 8 of 15
(3,496 Views)

Wrong example ... Here is the correct example...

 

Hummer1

0 Kudos
Message 9 of 15
(3,495 Views)

Keep linking to wrong example...just a second.

 

Hummer1

0 Kudos
Message 10 of 15
(3,493 Views)