Model Plugin – Initialize
- Updated2025-03-28
- 2 minute(s) read
A process model calls the Initialize entry point once in its controller thread before calling any other run-time entry points and before calling the ModelPluginOptions and ModelPluginConfiguration callbacks.
Typically, you implement Initialize only if you want to initialize variables or options before the process model calls the ModelPluginOptions and ModelPluginConfiguration callbacks. Because these callbacks can disable or remove plug-ins, no guarantee exists that the process model calls the End entry point for every plug-in that calls Initialize. Therefore, use the Begin entry point to perform any initialization that requires cleanup in End.
Do not use Initialize to perform initialization that depends on the values of model plug-in options because the subsequent ModelPluginOptions and ModelPluginConfiguration callbacks can alter the option values. Instead, use the Begin entry point to perform option-dependent initialization.
Initialize is the only run-time entry point in which you can change the enabled state of a plug-in instance.
Set the value of the FileGlobals.ModelPluginComponentDescription.Default.Base.AlwaysInitialize property to True for the process model to call the Initialize entry point and the ModelPluginOptions callback even if you do not enable the instance of the plug-in so that the plug-in and the client sequence file can dynamically enable or disable the instances of the plug-in.
If you set the value of the AlwaysInitialize property to False and the ModelPluginConfiguration callback enables a disabled instance of the plug-in, the process model calls the Initialize entry point and the ModelPluginOptions callback after the ModelPluginConfiguration callback returns.
The Initialize entry point accepts the following parameters:
Parameter Name | Data Type |
---|---|
ModelPlugin | NI_ModelPlugin |
ModelPluginConfiguration | NI_ModelPluginConfiguration |
ModelData | Container |