Introduction to Debugging OPNET Modeler

When using the OPNET Modeler software to run simulations, errors are often encountered. Finding and locating the error is the first step in solving the error. So how to locate the error? At this time, you need to use the simulation debugger (OPNET Simulation Debugger, ODB ) for debugging.
In OPNET, program debugging is mainly carried out through the simulation debugger. ODB is an inherent part of the simulation core, which can provide users with an environment for analyzing the running of the program. Users can interactively control the simulation through ODB and obtain event and object information .
To use ODB for debugging, first set the simulation kernel to "Development" or "Based on 'kernel_type' preference". If "Optimized" is used, ODB debugging cannot be performed, as shown in the figure below.
insert image description here
In addition, check the Use OPNET Simulation Debugger option on the Execution->OPNET Debugger interface on the left, as shown in the figure below.
insert image description here
If the simulation kernel is "Optimized", it will show that ODB is unavailable.
insert image description here
After running the simulation, the interface shown in the figure below will appear. Enter help on the command line and press Enter to see the classification of commands.
insert image description here
Among them, basic commands are used for basic operations of ODB; event commands are used for event operations; object commands are used for object operations, such as nodes, channels, etc.; packet commands are used for processing operations related to packets; process commands Used to handle process-related operations; stop and trace commands are used for breakpoint and trace operations, respectively.
In ODB debugging, the most effective debugging means are breakpoints and traces.
Enter help stop on the command line, and press Enter to display the commands related to the breakpoint, as shown in the figure below.
insert image description here
insert image description here
You can set a breakpoint according to the prompt, and then click continue, the simulation will run to the breakpoint and stop, and then manually run the simulation step by step to observe the changes in each step.
Similarly, you can enter help trace on the command line, and press Enter to display commands related to trace, as shown in the figure below.
insert image description here
insert image description here
You can also select the corresponding command to execute as needed.
The commands mentioned above are some more advanced debugging methods, which are not very useful for our simple programs. When debugging, generally we first choose the "Optimized" simulation kernel for simulation. If there is no problem with the simulation, we will not use ODB debugging, but if an error occurs and the process compilation is correct, we need to switch the simulation kernel to "Development". Or "Based on 'kernel_type' preference", and then use ODB for debugging. Keep pressing Next
after running the simulation until an error occurs and you can no longer continue to Next . At this time, a detailed error message will be printed on the OPNET ODB interface, indicating the function or error type in the code, and then we go to the corresponding position to modify the code. Then run the simulation to view the results, and so on until the error is resolved. OPNET debugging is a process of constantly making mistakes and then constantly trying to improve. I hope everyone can solve the errors smoothly during debugging!

Guess you like

Origin blog.csdn.net/weixin_42570192/article/details/130440929