Distributed Control & Automation Framework (DCAF)

cancel
Showing results for 
Search instead for 
Did you mean: 

No init.vi generated for Static Channel Module - where to put initialisation code?

Solved!
Go to solution

Hi All,

 

I see that the code generated for a static channel module does not include an init.vi.  Where would be the right place to put any initialisation code, and how would I pass references etc to user output and input vi's?

 

Bruce

0 Kudos
Message 1 of 7
(5,222 Views)

You can still add an override of the Init method for a module created from the static template, we just have not included it in the pre-scripted code since most folks do not need to change the default behavior.

 

Right-click on the runtime Class, choose New>>VI for Override... and select the Init method.

Cheers,

Matt Pollock
National Instruments
0 Kudos
Message 2 of 7
(5,216 Views)

Make sure you don't delete the 'call parent method' call when you make the override.  If you delete this, you'll lose the pre-scripted initialization code that creates the channels for your module.  Just extend it by doing your other calls after the 'call parent method' function.

Cheers,

Matt Pollock
National Instruments
0 Kudos
Message 3 of 7
(5,212 Views)

@MattP wrote:

Make sure you don't delete the 'call parent method' call when you make the override.  If you delete this, you'll lose the pre-scripted initialization code that creates the channels for your module.  Just extend it by doing your other calls after the 'call parent method' function.


Thanks Matt, my bad for not thinking OO!!  Quick question, I see the user output.vi is not passed the class data structure?  Why is this the case?  In the static module situation, it means the user output/input etc does not have access to class data.

 

In the Dynamic Channel situation, there are no user methods generated.

 

Bruce

0 Kudos
Message 4 of 7
(5,198 Views)
Solution
Accepted by topic author bdiesel

The user input, user process, and user output methods are there to completely abstract away the OO elements and just expose the data clusters.  This was done to allow a user with minimal LabVIEW knowledge to drop in an existing algorithm into a DCAF module.  We expect more advanced users will modify or delete them.

 

You don’t need to keep those methods - you can add items to their connector panes or delete the methods entirely and just edit the input, process, and output methods with whatever custom logic you desire.

Cheers,

Matt Pollock
National Instruments
0 Kudos
Message 5 of 7
(5,196 Views)

For an example, I'm working on a DAQmx Watchdog module that is based on the static template but also requires Init, Close, etc.

 

You can see how I structured things (though bear in mind it is still under development and probably has some bugs in there): https://github.com/LabVIEW-DCAF/daqmx-watchdog

Cheers,

Matt Pollock
National Instruments
0 Kudos
Message 6 of 7
(5,185 Views)

@MattP wrote:

For an example, I'm working on a DAQmx Watchdog module that is based on the static template but also requires Init, Close, etc.

 

You can see how I structured things (though bear in mind it is still under development and probably has some bugs in there): https://github.com/LabVIEW-DCAF/daqmx-watchdog


Okay, I seem to have it working, thanks!!

0 Kudos
Message 7 of 7
(5,172 Views)