包概述

注意: 使用 Model Assistant 包必须持有 OPNET Development Kit 许可证。

Model Assistant 包可用于增强从文本文件向网络模型导入数据的内置功能。一般工作流程如下:

  1. 新建一个选项卡笔记本页面,用于向用户请求输入。

  2. 为该笔记本页面编写特定的回调函数。这些回调函数是:

    a) 初始化处理器——在对话框打开时初始化页面 b) 保存处理器——将选项卡页面中的数据保存到文本文件 c) 加载处理器——将数据从文本文件加载到选项卡页面 d) 销毁处理器——在对话框关闭时调用 e) 应用处理器——在用户应用 model assistant 文件时调用。该函数将选项卡页面中指定的数据应用到网络上。

  3. 在 model-assistant 配置文件中新建一个条目。该文件为 Model Assistant 对话框中出现的每个选项卡页面保存一个条目,并定义导入引擎为每个页面使用的处理器函数。该文件位于以下目录:

    <reldir>/sys/configs

    该目录中可以存在多个配置文件;model_assistant_configuration_file 首选项决定当前会话使用哪个文件。该文件的格式见下图。

图 3:Model Assistant 配置文件示例

# Each line defines a block name, a set of handler functions, a visual resource
# file, and a tabbed page.

# The order of the blocks specify the order in which they appear in the Model
# Assistant dialog box, and the order in which they are executed when the user
# applies the assistant file.

# To remove a block from the dialog box, comment out the line that describes
# that block.

# RULE: Each block and the specified handlers for that block must be on a single
#          line.

# If a block line does not include a specific argument, the import engine uses
# the default argument (handler, resource, or page) defined for that block.

# RULE: Use colons to separate arguments. To use the default argument for that
#          block name, include an "empty argument" (that is, a space followed by a
#          colon).

# RULE: Each line should specify the arguments in the following order:
#          1) block_name:
#          2) apply_library.apply_handler:
#          3) resource_name:
#          4) page_name:
#          5) init_library.init_handler:
#          6) save_library.save_handler:
#          7) load_library.load_handler:
#          8) destroy_library.destroy_handler

# EXAMPLE: This block uses custom arguments:
link_specifications:dci_common.Dci_Ma_Link_Apply:dci_ma/dci_ma_dbox:dci_ma_dbox_link_page:dci_common.dci_ma_dbox_link_init_handler:dci_common.dci_ma_dbox_link_save_handler:dci_common.dci_ma_dbox_link_load_handler:dci_common.dci_ma_dbox_link_destroy_handler

# Remaining blocks use default arguments:
object_destruction
subnet_creation
node_creation
...