Package Overview
Note: You must have a license for the OPNET Development Kit to use the Project package.
The Ets_Pj package provides an API for accessing the network models associated with the scenarios of a project; for duplicating, switching, renaming, and destroying scenarios; and for starting or stopping a simulation run on the current scenario.
A project consists of any number of scenarios, only one of which is active at any given time. Each scenario consists of a network model, various pieces of data associated with that network that determine how the network behaves under simulation, and possibly the results of such a simulation. While the scenarios of a project might have similar objects and topology and be essentially variants of each other, this need not be the case. It might also be the case that there is no correspondence between the objects in one scenario and the next, so no assumptions along these lines are made.
Most of the functions in this package require that the specified project be open in the Project Editor (opened either programatically with Ets_Tool_Open() or by the user from the GUI). However, the following functions also work with projects opened "behind the scenes" with Ets_Model_Create() or Ets_Model_Read():
- Ets_Pj_Scenario_New()
- Ets_Pj_Scenario_Count_Get()
- Ets_Pj_Scenario_Current_Index_Get()
- Ets_Pj_Scenario_Destroy()
- Ets_Pj_Scenario_Duplicate()
- Ets_Pj_Scenario_Index_Get()
- Ets_Pj_Scenario_Index_Set()
- Ets_Pj_Scenario_Name_Get()
- Ets_Pj_Scenario_Name_Set()
- Ets_Pj_Scenario_Switch()
For example, the following code operates on project ABCDE outside of the Project Editor (and thus out of the user's sight). It creates the project (if necessary), then makes various changes to the project's scenarios.
EtsT_Model_Handle pj_model_hndl;
char path [1024];
EtsT_Compcode status;
if (prg_tfile_path_get ("ABCDE", PrgC_Tfile_Type_Project, path, 1024) != PrgC_Compcode_Success)
{
// Project doesn't exist, so create it and add some scenarios
pj_model_hndl = Ets_Model_Create (EtsC_Model_Pj);
Ets_Model_Name_Set (pj_model_hndl, "ABCDE");
Ets_Pj_Scenario_New (pj_model_hndl, "FGZ");
Ets_Pj_Scenario_New (pj_model_hndl, "QQQ");
Ets_Pj_Scenario_New (pj_model_hndl, "IJK");
Ets_Pj_Scenario_New (pj_model_hndl, "LMN");
}
else
{
// Project exists, so open it
pj_model_hndl = Ets_Model_Read (EtsC_Model_Pj, "ABCDE", &status);
}
// Make some changes to the scenarios
Ets_Pj_Scenario_Duplicate (pj_model_hndl, "OPQ");
Ets_Pj_Scenario_Name_Set (pj_model_hndl, 0, "FGH");
Ets_Pj_Scenario_Destroy(pj_model_hndl, 1);
Ets_Pj_Scenario_Duplicate (pj_model_hndl, "RST");
Ets_Pj_Scenario_New (pj_model_hndl, "UVW");
Ets_Pj_Scenario_Switch (pj_model_hndl, "IJK");
// Close the project
Ets_Model_Write (pj_model_hndl, VOSC_NIL);
Ets_Model_Destroy (pj_model_hndl);