Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Data in AF

Solved!
Go to solution

Hi,

 

I am working on my first AF project and up to now everything has been going quite smoothly. The basic UI is all sorted, data can be loaded and displayed fairly easily.

 

What I now want to do is have the ability to "play" the data back on the UI, as in view each set of samples one at a time at a selectable frequency.

 

My application is based on an example from MGI, where you can drag "data" from a list box into an actor (waveform etc.) and it is displayed. So the data is contained within the actor. What I want to have is a "remote control" that I can use to play, pause, step through the data.

 

How is this best achieved? My initial thought was to send a message to all the relevant actors that simply said "show the next data point" and the individual actors updated accordingly (by moving the cursor one sample, displaying another point etc.). How would I send this message to all the actors at the same time, would I have a message that was a user event that fired in each actor? Or would I actually send the sample number I wanted to display? Assume for now that every data set is the same frequency and has the same number of points, this will change but one problem at a time...

 

What I am struggling with is how to get the message data (the sample number) to impact the FP of the actor. I can get it to the "Do.vi" but then how do I get this to the data/waveform on the FP? Does the Do.vi need to include a reference to the FP objects?

 

Any pointers would be a great help, I'm not expecting anyone to write this for me, just let me know what the standard way of doing this is.

 

Thanks for the help!

Darren.

0 Kudos
Message 1 of 6
(3,844 Views)
Solution
Accepted by topic author REAL!

Hi Darren,

 

in the actor framework you can do this in 2 ways : with user events or with control references. The method inside your "Do.vi" is a public vi of your actor class, which means it can access the private data of the actor class. The private data of the actor should contain either a reference to a user event for updating the value of the control or it should contain the reference to the control. I think that if your actor already has a user event structure that it is recommended (by NI???) to use the user event approach, otherwise you could choose to work with the control references. At least that is what I understood when I did the Actor Framework badge test.

 

However we always use the control reference approach. Because I don't want to create a user event to update value, enable/disable, show/hide,... for my control. By storing the reference to the control in the actor class I can do all of this at once in my method vi.

You can find an AF tutorial I made here. This shows the steps how to go from basic actor to actor with lvlibp's as plugins.

You won't (yet Smiley Wink ) need all the last steps but hopefully the first examples can show you how we do this.  Example 2 might help you.

 

If you decide to go for the other option (user events) you can take a look at the LabVIEW Architects Forum on Youtube. There is a recording of a presentation and the actors that are used there are done with the user event approach. You can find it here.

 

Best Regards,

Stefan Lemmens

Intersoft Electronics

 

 

 

 

Message 2 of 6
(3,832 Views)

Awesome sauce! Thanks Stefan!!

 

I am more comfortable with using a reference, so will stick with that way as I also use it elsewhere in the same program (consistent design and all that...).

 

Thanks again,

Darren.

0 Kudos
Message 3 of 6
(3,825 Views)

That was also the reason why we started this way with the actor framework (already 4 years ago) and back then the examples that I found where also using control references. I haven't noticed any disadvantages yet except that if you're using a lot of property nodes you might want to defer panel updates otherwise your FP updates might slow down your application. But that goes for all the places in your code where you use property nodes.

If you're attending the DutLUG next week I will be more than happy to discuss some more AF in real life.

 

Best Regards,

Stefan Lemmens

Intersoft Electronics

 

0 Kudos
Message 4 of 6
(3,817 Views)

Hi Stefan,

 

Each Actor that has a UI will be displayed as a sub-panel on the main Actor UI, so any changes to properties can be done locally on the Actor itself, however I don't think this will be very often. Maybe adjusting the scale of a waveform, plot colour, that kind of thing. But as you say, it's something to be aware of everywhere in the code.

 

Unfortunately I can't make it to the DutLUG as I'll be on vacation with my son. I am taking him to Lapland to see Santa, but shhh, it's a secret! (He thinks he's just going to see Nanna and Grandad back in the UK).

 

Enjoy the DutLUG and will try for the next one!

 

Cheers,

Darren.

0 Kudos
Message 5 of 6
(3,800 Views)

For those interested in using user events with UI Actors there is a set of wizards that allow you to quickly create UI actors from a template, and then add user events to handle updates to its front panel indicators. This "Events for UI Actor indicators" package can be found here.

 

Best Regards,

Stefan Lemmens

Intersoft Electronics

0 Kudos
Message 6 of 6
(3,765 Views)