Jump to content

Queue, Notifier or User Events ?


Recommended Posts

Hello,

I love the synchronisation palette of LV and multitasking functionality of them. My actually application architecture for communicating with devices over any interface is following:

My application contains e.g. 5 tasks:

1. main task - is a state machine with ca. 10 steps.

2. read & parse task

3. log data to hard drive task

4. show data to user task

5. write data (command) to devise task

steps in the main task are following:

1. settings - reads and writes settings cluster to a XML-File. If no XML-File exists, a settings window pops up, user have to make settings and they will be written to a new XML-File.

2. open interfaces - inits and opens interfaces to devices with settings from XML-File

3. start tasks - starts another (see above) tasks dynamically.

4. wait on commands - contains a event structure, which queries user events from FP

5. reinit program - if settings are changed by user, all tasks will be reset with Set Value Property, device interfaces will be closed and reinit

then if user want to exit program

6. stop tasks - all tasks will be stopped by closing queue or notifier refnums

7. terminate tasks - if any task runs after closing refnums (normally not used) then this task will be aborted

8. close interfaces

9. exit LV

Also, to communicate between tasks I use (easy example with only one devise):

1. One queue - read&parse task put messages into this queue and log task gets this messages and logs them to hard drive

2. One notifier - read&parse task put messages to notifier and show task gets them and shows to user

3. One notifier - user puts any commands to this notifier and "send to devise" task gets them and sends to devise

Its okey? Good or bad?

Now I want to replace my communication mechanism because of following problem:

http://forums.lavag.org/index.php?s=&s...ost&p=28344

What do you think about it?

best regards, Eugen

Link to comment

QUOTE(Eugen Graf @ Apr 24 2007, 01:44 PM)

P.S. can anybody say me, how to set timeout in "Wait On VISA Event" to unlimited?

I am not sure, but usually -1 is the number you have to wire, if you want an unlimited timeout ... but I don't know if this is working with VISA, too (and I am to lazy to take a look now ;) )

Link to comment

QUOTE(i2dx @ Apr 24 2007, 05:16 PM)

I am not sure, but usually -1 is the number you have to wire, if you want an unlimited timeout ... but I don't know if this is working with VISA, too (and I am to lazy to take a look now ;) )

Timeout -1 or better FFFFFFFFh should be possible, but I get "Timeout Error" if I do it. It's a bug?

Eugen

Link to comment
  • 2 weeks later...

Thank you, Michael.

Your recommendation with Variant Data and Action solves NEARLY ALL of my problems. Here I can use Queues or User Events, no functional difference is to recognize. The problem was to "OR" queues in tasks and with variance I can do it.

Eugen

Link to comment

QUOTE(Eugen Graf @ May 4 2007, 12:13 AM)

...no functional difference is to recognize...

No, if I want to "say" to more than one task about new settings, I have to use User Events (or Notifier?) but no queues. Because if I dequeue new settings in a task, than other will dont get it.

Eugen

Link to comment

QUOTE(Michael_Aivaliotis @ May 4 2007, 10:43 AM)

I actually mentioned this in my post http://forums.lavag.org/index.php?s=&showtopic=7531&view=findpost&p=28409' target="_blank">here. Sorry if it wasn't clear. However, you can combine functionality into a task to handle this.

Sorry, I can't solve my problem with your VI. Here a screenshot.

Eugen

Link to comment

QUOTE(Eugen Graf @ May 4 2007, 02:34 AM)

No, if I want to "say" to more than one task about new settings, I have to use User Events (or Notifier?) but no queues. Because if I dequeue new settings in a task, than other will dont get it.

I've done something similar, and my solution was to give each task its own queue. If you must have one queue, you could make the Action specific to each task (e.g. Update settings - main, Update settings - read, etc.), and if a task dequeued an instruction that wasn't applicable to it, it sticks it back in the queue.

Link to comment

Ups, sorry, see here http://forums.lavag.org/index.php?s=&s...ost&p=29306

Probably I am to nervous if I see my project at work an if my boss say me to make it faster. If a am home I see, where the problem is. I can imagine how to make it right, but if a am on work...

Eugen

So I have only to memorize :throwpc: , that a queue can not simply be a data buffer, but it can have a important functionality. It can "say" to a task, what to do with data in the same message. It's very significant for me.

Eugen

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.