Parameters


Files

file  parameter.h
 definition of the Parameter types
file  parmanager.h
 Manager for the all the Parameters.

Classes

class  DETimeParameter
 DETime parameter type. More...
class  GenericParameter
 Base class for all the parameter types. More...
class  IntParameter
 Integer number parameter type. More...
class  DoubleParameter
 Double number parameter type. More...
class  StringParameter
 String parameter type. More...
class  EnumParameter
 Enumeration parameter type. More...
class  BitmaskParameter
 BitmaskParameter parameter type. More...
class  ParamManager
 this class manages all the parameters of a simulation More...

Detailed Description

A Parameter is NePSing way to write and read simulation's parameters to a file. In this way, a single program can be tuned and modified to simulate a great variety of cases. As an example, in a Aloha protocol simulator, the parameters can be used to set if it is a slotted or unslotted protocol type, the data source rate, the retransmission probability and so on.

NePSing has a number of parameter types, and each parameter is defined in the class its belongs to. Each parameter must be read according to its type, aka, a parameter defined as StringParameter cannot be read as a DoubleParameter.

Moreover, each parameter class can have instances. An instance is a subclass of a parameter, allowing an even greater flexibility. As an example a generic traffic source can have 3 instances, Gold, Silver and Bronze. If instances are not used, leave the instance field blank in the reading code; i.e, with an empty string.

Each parameter is written in a parameter file by the program itself (see the demo project). Upon reading the parameter file, if a paramer is found in it, the value will override the parameter's default value. If a class have some instances, the reading rule will be:

Usual parameter definition (to be done in a static setup function) is:
 Param->addClass ("Generator", "Message generator");
 
 Param->addInstance("Generator", "Gold", "Gold Terminal");
 Param->addInstance("Generator", "Silver", "Silver Terminal");
 Param->addInstance("Generator", "Bronze", "Bronze Terminal");
 
 Param->addParameter ("Generator", new DETimeParameter("MsgIntTime",  "Msg. interarr.", "1.0", "(0,inf)" ));
 Param->addParameter ("Generator", new DoubleParameter("MsgLength",  "Msg. length", "5.0", "(0,inf)" ));

the corresponding parameter reading (to be done in the Initialize() function) is:

 string GenType // set this to "Gold", "Silver" or "Bronze"
 
 DETime MsgInterarrTime = get < DETimeParameter, DETime > (Param, "MsgIntTime", "Generator", GenType);
 double MsgLength = get < DoubleParameter, double > (Param, "MsgLength", "Generator", GenType);

Generated on Wed Dec 22 23:23:50 2004 for NePSing by doxygen 1.3.9.1 ---- Hosted by SourceForge.net Logo