Delacor Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Send a message versus call a subVI

Solved!
Go to solution
Highlighted

Send a message versus call a subVI

Hey guys,

 

I recently came across this for the Actor Framework: http://forums.ni.com/t5/forums/v3_1/forumtopicpage/board-id/7101/thread-id/4033/page/1

 

The basic idea as I read it is to not have a message call another message, rather just call the subVI.

 

Do you have the same thoery or idea for DQMH?  For example, I have a system something like thermochamber examples.  There is some sort of "Set set point" request.  But in the Initialize event, I want to read in an INI and intialize the set point to that value.  So, do I send the "Set set point" request from the init case or do I simply place the set set point subVI in the init case?

 

Part of this assumes most requests are a single VI or at least close.

 

Thanks

0 Kudos
Message 1 of 3
(598 Views)
Solution
Accepted by topic author Evan
02-03-2017 10:10 AM

Re: Send a message versus call a subVI


Hi Evan,

 

This is very timely, just yesterday I was on a code review with a customer and we were discussing this. We are even debating if we should get rid of the "Update Display" case in the MHL for the template. I am copying here two points from the DQMH Best Practices document:

 

  • Calling Status Updated.vi should be used over enqueuing Update Display message, even if done as a high priority message. Otherwise, the order of the status messages is not correct in the DQMH API Tester VI.
  • Atomic operations should be in a single MHL case. We cannot guarantee that other actions do not get enqueued in between MHL cases.

One of the earliest discussions in this forum resulted in us changing the Main.vi template to have a single initialize case in the MHL as opposed to having three messages enqueued. 

The main reason is that you cannot guarantee things are going to get enqueued in between the two steps. Also, during debugging, we have come to appreciate having more atomic operations within each MHL case. It is tempting to reuse the code in a case by enqueing in different places, but a better approach is to have a subVI within that MHL case and call the VI instead. 

 

Regards,

Fab

 

 

Certified LabVIEW Architect * Certified Professional Instructor * LabVIEW Champion
0 Kudos
Message 2 of 3
(567 Views)

Re: Send a message versus call a subVI

Thanks Fab.

0 Kudos
Message 3 of 3
(561 Views)