Book contents
- Frontmatter
- Contents
- Preface
- List of abbreviations
- Part I Preparation for OPNET Modeling
- Part II Modeling Custom Networks and Protocols
- 4 OPNET programming interfaces
- 5 Creating and simulating custom models using OPNET APIs
- 6 High-level wrapper APIs
- 7 Modeling with high-level wrapper APIs
- Part III Modeling and Modifying Standard Networks and Protocols
- Part IV OPNET Modeling Facilities
- References
- Index
7 - Modeling with high-level wrapper APIs
from Part II - Modeling Custom Networks and Protocols
Published online by Cambridge University Press: 05 February 2012
- Frontmatter
- Contents
- Preface
- List of abbreviations
- Part I Preparation for OPNET Modeling
- Part II Modeling Custom Networks and Protocols
- 4 OPNET programming interfaces
- 5 Creating and simulating custom models using OPNET APIs
- 6 High-level wrapper APIs
- 7 Modeling with high-level wrapper APIs
- Part III Modeling and Modifying Standard Networks and Protocols
- Part IV OPNET Modeling Facilities
- References
- Index
Summary
This chapter first revisits the cases described in Chapter 5 but utilizing high-level wrapper APIs instead. Then, another case is demonstrated to illustrate how to create connectionoriented communications. To follow this chapter, it is assumed that a reader understands the content covered in Chapter 5 and Chapter 6.
Revisit of previous case
In this section, Case 6 in Chapter 5 is revisited but this time with wrapper APIs.
Open “pk_switch” process model in Process Editor. Save it as “pk_switch_v2”. Now, you can edit “pk_switch_v2” and replace relevant code with wrapper APIs. In SV block, replace the declarations of state variables, as shown in Figure 7.1.
In TV block, replace the declarations of temporary variables, as shown in Figure 7.2.
In HB block, include header files: “routing.h” and “geo_topo.h”, as shown in Figure 7.3. These two files include relevant wrapper APIs for performing routing and topology related operations.
In “init” state, replace previous code for building the graph and routing table with the new code that utilizes wrapper APIs, as shown in Figures 7.4 and 7.5.
From Figures 7.4 and 7.5, it is seen that after applying the wrapper APIs, the processing of vertices and edges in the routing graph is performed by dealing with W_Vertex_Info andW_Edge_Info objects. The steps for implementing routing algorithm can be represented by the corresponding wrapper APIs in the following way:
Initialize graph – w_init_graph().
Set vertices of the graph – w_set_graph_vertices().
[…]
- Type
- Chapter
- Information
- Unlocking the Power of OPNET Modeler , pp. 110 - 122Publisher: Cambridge University PressPrint publication year: 2012