Access Model Hierarchy Function
- Updated2023-03-14
- 6 minute(s) read
Owning Palette: Model Hierarchy Functions
Requires: Control Design and Simulation Module
Accesses model parameters and signals in a hierarchy of Simulation functions and subsystems. You can use this function to collect signal values at run time. You also can use this function to configure parameters of multiple functions and subsystems rather than configuring them individually.
![]() | Tip Use the configuration dialog box for this function to view the hierarchy of simulation nodes in a VI. |
The following conditions must be true for you to access a model or signal, respectively:
- To access a model parameter whose source is a wired block diagram input, you must remove the wire to the input or change the source to be from the configuration dialog box for the function or subsystem. Otherwise, LabVIEW returns error code –2389.
- To access a signal, you must wire the signal out of the node from which it originates. You also must configure a nonzero decimation period along with other simulation parameters.
| Dialog Box Options |
| Block Diagram Inputs |
| Block Diagram Outputs |
Dialog Box Options
| Parameter | Description | ||
|---|---|---|---|
| Accessors | Lists accessors, which correspond to block diagram terminals on this function that access model parameters and signals. To associate an accessor with a model parameter or signal, click the name of the accessor, and then identify the item in the Browse Model Hierarchy section.
| ||
| VI with Simulation | Specifies the location on disk of the VI that contains the simulation hierarchy you want to access. By default, this function selects the current VI. | ||
| Select VI in memory | Displays a dialog box that lists all VIs in memory that contain a simulation diagram or diagrams. You can use this dialog box to select the VI with Simulation whose model hierarchy you want to access. | ||
| Accessor Properties | Contains the following options for configuring how accessors interact with a model parameter or signal:
| ||
| Browse Model Hierarchy | Contains the following options for identifying a model parameter or signal to access:
| ||
| Parameter Value | Allows you to specify a value to set for the model parameter you select in the Select a parameter or signal list. When you configure the Get/Set option to Get, LabVIEW disables this section. You only can get signals, so LabVIEW also disables this section for accessors associated with signals. When this function executes, any values you wire to block diagram inputs take precedence over values you specify in this section. |
Block Diagram Inputs
| Parameter | Description | ||
|---|---|---|---|
| VI reference in | Contains a reference to the VI whose model hierarchy you want to access. Leave this input unwired to access the VI specified in the configuration dialog box. This input is useful for accessing model parameters or signals of VIs in other application instances. | ||
| error in | Describes error conditions that occur before this node runs. | ||
| accessor path | Specifies the location of the model parameter or signal you want to associate with the accessor. If you specify a path in the Path to model parameter or signal dialog box option, this function does not display this input. Refer to the Details section for information about the format of this path. | ||
| value | Specifies the value to set for the model parameter associated with this accessor. When this function executes, values you wire to this input take precedence over values you specify in the configuration dialog box. If you configure an accessor to get a model parameter or a signal, the function does not display this input.
|
Block Diagram Outputs
| Parameter | Description | ||
|---|---|---|---|
| VI reference out | Returns the reference to the VI. | ||
| error out | Contains error information. This output provides standard error out functionality. | ||
| value | Returns the value from the model parameter or signal associated with this output. If you configure this function to set the value of a model parameter, the function does not display this output.
|
Access Model Hierarchy Details
You can access multiple parameters and signals using a single Access Model Hierarchy function. Use the configuration dialog box for the function to add accessors, or resize the function on the block diagram to add new terminals. A small direction arrow to the right of the accessor value terminal indicates a read operation. A small direction arrow to the left of the terminal indicates a write operation. To change the operation of an accessor associated with a model parameter, right-click the terminal and select Change Item to Get or Change Item to Set from the shortcut menu. You cannot perform a set operation on a signal.
Accessors have short, long, and alias names you can change by right-clicking this function and selecting Name Format from the shortcut menu. You configure the alias for an accessor in the configuration dialog box.
![]() | Note This function must execute while the VI or subsystem that contains the model parameters or signals is running or reserved for execution. Otherwise, LabVIEW ignores the configuration when the function runs and returns warning –2387. |
Formatting Parameter Paths
The strings that identify model parameter and signals are in the format loop label (if any).top subsystem label (if any).nested subsystem label (if any).function label.parameter.
Examples
Refer to the following VIs for examples of using the Access Model Hierarchy function:
- SimEx Initializing Model Parameters VI: labview\examples\Control and Simulation\Simulation\Get-Set Model Parameters
- SimEx Setting Model Parameters at Runtime VI: labview\examples\Control and Simulation\Simulation\Get-Set Model Parameters
- labview\examples\Control and Simulation\Simulation\Real-time\SimEx Setting Model Parameters to RT.lvproj
- SimEx Collecting Model Signals VI: labview\examples\Control and Simulation\Simulation\Signal Collection
- SimEx Getting Model Signals at Runtime VI: labview\examples\Control and Simulation\Simulation\Signal Collection

