|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectpacemaker.Firefly
pacemaker.FireflyProtocol
public class FireflyProtocol
The implementation of a protocol inspired by Fireflies.
| Field Summary | |
|---|---|
double |
adjustable_period
the period we choiced to use, for models that adjust the frequency of flashing, eg ADAPTIVE model
NOW it's a double: store also micro-adjustment. |
long |
birth
the time when I first come to life, in Simulator time. |
int |
cycle
Count the number of cycles done. |
long |
last_cycle_time
the time (simulator's timestamp) we start the last cycle. |
long |
last_flash_time
The LAST TIME (simulator's timestamp) we DO FLASH. |
long |
last_stimulus_time
the time (simulator's timestamp) we received the last stimulus (other's pulse) from the environment. |
static int |
lid
Identifier of the linkable ID |
int |
n_received
How many msg I received since birth |
long |
next_cycle_time
the time (simulator's timestamp) we scheduled our next cycle. |
static java.lang.String |
PAR_FANOUT
|
static java.lang.String |
PAR_HEAR
|
static java.lang.String |
PAR_START
String name of the parameter used to configure the starting time of the firefly protocol, e.g. |
static int |
pid
Identifier of the protocol ID |
int |
start
|
static int |
tid
Identifier of the transport ID |
int |
timestamp
Useful for implementing a technique of modifiable timer for peersim EDSimulator. |
| Fields inherited from class pacemaker.Firefly |
|---|
b, epsilon, inert, max, min, model, PAR_B, PAR_EPSILON, PAR_INERT, PAR_MAX, PAR_MIN, PAR_MODEL, PAR_PERIOD, PAR_PREP, PAR_PULSE_DURATION, PAR_RELAXATION, PAR_SPECIES, period, prep, pulse_duration, relaxation, species |
| Constructor Summary | |
|---|---|
FireflyProtocol(java.lang.String prefix)
|
|
| Method Summary | |
|---|---|
void |
doFlash()
Do Emission of a Firefly Flash. |
double |
getAdjustable_period()
|
void |
initSchedule()
Run just after contructor or Firefly.clone(),
here we must set up a first event delivered to self:
because execution took place in a node when an event is delivered,
without this such first event, this node won't start. |
void |
processEvent(peersim.core.Node node,
int p_id,
java.lang.Object event)
Process 2 types of events: Timer (when clock ticks) and Pulse (from other fireflies). |
void |
receive(peersim.core.Node node,
int pid,
java.lang.Object event)
Called by processEvent(Node, int, Object) when the event is a
light pulse from a neighbor firefly. |
void |
setPeriod(int value)
Setter for use with initializers. |
void |
setStart(int value)
Setter for use with initializers. |
| Methods inherited from class pacemaker.Firefly |
|---|
clone |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface peersim.core.Protocol |
|---|
clone |
| Field Detail |
|---|
public static final java.lang.String PAR_START
Suggestion: First flash must not be all-together: what you want to find if you already start in sync?.
Some ways to start:
Defaults to: random start time during first period.
public int start
public static final java.lang.String PAR_FANOUT
public static final java.lang.String PAR_HEAR
public static int lid
public static int tid
public static int pid
public int cycle
public int timestamp
EDSimulatorpublic long last_cycle_time
Note that a cycle do not imply flashing.
Ex: DELAY model.
public long next_cycle_time
Note that a cycle do not imply flashing.
Ex: DELAY model.
public long last_flash_time
public double adjustable_period
ADAPTIVE model
NOW it's a double: store also micro-adjustment.
public long last_stimulus_time
public long birth
public int n_received
| Constructor Detail |
|---|
public FireflyProtocol(java.lang.String prefix)
| Method Detail |
|---|
public double getAdjustable_period()
public void initSchedule()
Fireflycontructor or Firefly.clone(),
here we must set up a first event delivered to self:
because execution took place in a node when an event is delivered,
without this such first event, this node won't start.
initSchedule in class FireflyFirefly.initSchedule()public void setStart(int value)
public void setPeriod(int value)
XXX note the conversion from int (randomized by setter) to double
public void doFlash()
FireflyHere you implement a 'firefly flash' so you should keep in mind some characteristics of that flash:
doFlash in class Firefly
public void processEvent(peersim.core.Node node,
int p_id,
java.lang.Object event)
The periodic timed flash of a firefly will be implemented as a special event delivered each period to the node itself.
processEvent in interface peersim.edsim.EDProtocol
public void receive(peersim.core.Node node,
int pid,
java.lang.Object event)
processEvent(Node, int, Object) when the event is a
light pulse from a neighbor firefly.The models (ADVANCE,DELAY,MAS,ADAPTIVE...) are applied here: choice how to react to the event.
receive in class Firefly
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||