op_sim_error()

摘要

打印指定的错误消息,并可选择终止仿真。

语法

op_sim_error (gravity, line1, line2)
参数 类型 说明
gravity OpT_Sim_Error_Gravity 错误的严重程度(参见详情一节)。
line1 const char * 错误消息的第一行,或 OPC_NIL。
line2 const char * 错误消息的第二行,或 OPC_NIL。

返回类型

void

无返回值。

示例

op_sim_error (OPC_SIM_ERROR_WARNING, "Error message line 1", "message line 2");

上述语句产生的输出类似于:

|-----------------------------------------------------------------------------|
| <<< Warning >>>                                                             |
| Error message line 1                                                        |
| message line 2				                                                              |
| T (0), EV (0), MOD (top.node_0.p_0), PROC (s52825 [st_0 enter execs])       |
|-----------------------------------------------------------------------------|

详情

gravity 参数必须是以下之一:

  • OPC_SIM_ERROR_DIAGNOSTIC
  • OPC_SIM_ERROR_WARNING
  • OPC_SIM_ERROR_RECOVER
  • OPC_SIM_ERROR_ABORT

如果 gravity 为 OPC_SIM_ERROR_ABORT,该内核过程将结束仿真(类似于调用 op_sim_end())。

用途

提供了一种打印诊断错误、警告、可恢复错误或程序中止消息的机制,消息最多两行。每条消息都会附带产生该错误时的仿真时间、事件、模块和进程。

错误

  • 不捕获任何错误。

参考

  • 无

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com