close Warning: BrowserModule failed with ConfigurationError: Look in the Trac log for more information.

Changes between Version 19 and Version 20 of OverSimDevelop


Ignore:
Timestamp:
Apr 28, 2009, 1:44:09 PM (15 years ago)
Author:
heep
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OverSimDevelop

    v19 v20  
    192192== 4. Implementing the overlay and application modules ==
    193193
    194 In this section, we'll implement our overlay and application. But first, let's do a introduction about some of the important variable types used in OverSim.
     194In this section, we'll implement our overlay and application. But first, let's do a introduction about some of the important variable types used in !OverSim.
    195195
    196196BaseOverlay:        Template overlay module class. All overlay modules should derive from it.[[BR]]
     
    201201{{{
    202202#!cpp
    203 OverlayKey();           // initializes the key as UNSPECIFIED. While in this value, most of the key operations are invalid!
     203OverlayKey();           // initializes the key as UNSPECIFIED.
     204                        // While in this value, most of the key operations are invalid!
    204205OverlayKey(5);          // initializes the value as an 32-bit integer.
    205206OverlayKey(buffer, 32); // initializes the value from the first 32 bytes of buffer.
     
    401402
    402403    // overlay routines
    403     void initializeOverlay(int stage);                      // called when the overlay is being initialized
    404     void setOwnNodeID();                                    // (optional) called to set the key of this node (random otherwise)
    405     void joinOverlay();                                     // called when the node is ready to join the overlay
    406     void finalizeOverlay();                                 // called when the module is about to be destroyed
     404    void initializeOverlay(int stage);              // called when the overlay is being initialized
     405    void setOwnNodeID();                            // (optional) called to set the key of this node (random otherwise)
     406    void joinOverlay();                             // called when the node is ready to join the overlay
     407    void finalizeOverlay();                         // called when the module is about to be destroyed
    407408
    408409    // obligatory: called when we need the next hop to route a packet to the given key
    409     NodeVector* findNode(const OverlayKey& key,             // key to route to
     410    NodeVector* findNode(const OverlayKey& key,     // key to route to
    410411                         int numRedundantNodes,     // next hop candidates to return if we're not responsible for "key"
    411412                         int numSiblings,           // how many siblings to return if we're responsible for "key"
     
    414415    // obligatory: In general, called when we need to know whether "node" is amongst numSiblings closest nodes to "key".
    415416    // But normally it is called with "node" set to "thisNode", and asking whether we are responsible for "key"
    416     bool isSiblingFor(const NodeHandle& node,               // which node (usually thisNode) we're referring to
    417                       const OverlayKey& key,                // key in question
    418                       int numSiblings,                      // how many siblings we're querying about
    419                       bool* err);                           // set to false when we couldn't determine the range
     417    bool isSiblingFor(const NodeHandle& node,       // which node (usually thisNode) we're referring to
     418                      const OverlayKey& key,        // key in question
     419                      int numSiblings,              // how many siblings we're querying about
     420                      bool* err);                   // set to false when we couldn't determine the range
    420421
    421422    // obligatory: Set the maximum number of siblings that can be queried about in isSiblingFor(usually 1)
     
    541542== 5. Configuring the Simulation ==
    542543
    543 Now that the overlay module is implemented, we still need to set up a network in order to run that overlay. To do that, we need to edit the omnetpp.ini file, or set up a custom configuration file. The configuration file should be located in the <OverSim>/simulation folder.
     544Now that the overlay module is implemented, we still need to set up a network in order to run that overlay. To do that, we need to edit the omnetpp.ini file, or set up a custom configuration file. The configuration file should be located in the !OverSim/simulation folder.
    544545
    545546== 5.1 Setting Parameters ==
    546547
    547 The user can set custom values for module parameters in the file omnetpp.ini (or whichever configuration file you use), or in default.ini for general default values, located in the <OverSim>/simulation folder. Parameters are hierarchic, separated by a dot for each layer. For example, setting a parameter for a specific overlay module in a node can be done as follows:
     548The user can set custom values for module parameters in the file omnetpp.ini (or whichever configuration file you use), or in default.ini for general default values, located in the !OverSim/simulation folder. Parameters are hierarchic, separated by a dot for each layer. For example, setting a parameter for a specific overlay module in a node can be done as follows:
    548549
    549550{{{
     
    566567Should a module parameter not be set in either configuration file, or match any wildcard, !OverSim will prompt the user to enter a value for each instance of the module. For simulations with a big amount of nodes, setting each parameter individually quickly becomes overwhelming. Therefore, it is recommended that every module parameter be assigned a default value in default.ini.
    567568
    568 Notice that these are parameter paths, not to be confused with module paths from NED declarations (see Section 2.1). In this case, the parameter paths describe a set of modules and submodules to follow to reach the inner parameter we want. On the other hand, the module paths describe the folder under <OverSim>/src/ in which the declaration of the NED module will be found.
     569Notice that these are parameter paths, not to be confused with module paths from NED declarations (see Section 2.1). In this case, the parameter paths describe a set of modules and submodules to follow to reach the inner parameter we want. On the other hand, the module paths describe the folder under !OverSim/src/ in which the declaration of the NED module will be found.
    569570
    570571== 5.2 Creating our Configuration File ==
    571572
    572 Let's create a configuration file in <OverSim>/simulations called mysim.ini.
     573Let's create a configuration file in !OverSim/simulations called mysim.ini.
    573574
    574575The default.ini file contains the default values for many overlay parameters, and therefore it's highly useful to include it in our file. Since the simulator will use the first value it sees, the default value should go at the end.
     
    587588#!cpp
    588589[General]
    589 sim-time-limit = 1000s                                              // set all simulations to last 1000 seconds
    590 network = "oversim.underlay.simpleunderlay.SimpleUnderlayNetwork"   // this is a module path! do not confuse with parameter paths.
     590// set all simulations to last 1000 seconds
     591sim-time-limit = 1000s
     592
     593// this is a module path! do not confuse with parameter paths.
     594network = "oversim.underlay.simpleunderlay.SimpleUnderlayNetwork"
    591595}}}
    592596
     
    597601Now, once the network type has been set, we can set the parameter values that we'll need. For example, let's create a configuration called "Example". There are two basic parts that should be configured: the churn type, and the node parameters.
    598602
    599 The churn type tells OverSim how often it should add or delete nodes from the network. There are many churn types (e.g. NoChurn for a static network, LifetimeChurn for creating nodes with a given lifetime distribution, and so on); for a complete list see the ned files in <OverSim>/src/common. In our example, we'll use the less interesting NoChurn, which disables churn in our network. There are plenty of examples in <OverSim>/simulations/omnetpp.ini for all churns.
     603The churn type tells OverSim how often it should add or delete nodes from the network. There are many churn types (e.g. NoChurn for a static network, LifetimeChurn for creating nodes with a given lifetime distribution, and so on); for a complete list see the ned files in !OverSim/src/common. In our example, we'll use the less interesting NoChurn, which disables churn in our network. There are plenty of examples in !OverSim/simulations/omnetpp.ini for all churns.
    600604
    601605The second part are the node parameters. Two node parameters are obligatory: tier1Type (to specify the application module), and overlayType (for the overlay module). Further parameters can be specified for these application and overlay modules. For this example, we'll use the module !MyOverlayModules, which we declared in a previous chapter.
     
    688692In order to run it, you need to setup your configuration in omnetpp.ini as explained in Section 4. Make sure that you selected default values for all parameters in default.ini, or you'll be prompted for a value when the simulation begins (for each module that uses that parameter!).
    689693
    690 There are two ways to start !OverSim: by using the GUI (Tkenv) or through the command line (Cmdenv). To run !OverSim, enter the directory <OverSim>/simulations and run :
     694There are two ways to start !OverSim: by using the GUI (Tkenv) or through the command line (Cmdenv). To run !OverSim, enter the directory !OverSim/simulations and run :
    691695
    692696{{{