pacemaker
Class Firefly

java.lang.Object
  extended by pacemaker.Firefly
Direct Known Subclasses:
FireflyProtocol

public abstract class Firefly
extends java.lang.Object

See Also:
species

Field Summary
static int b
           
static double epsilon
           
static int inert
           
static int max
           
static int min
           
static java.lang.String model
           
static java.lang.String PAR_B
          String name of the paramater used to determine the form of the Phase Response Curve (PRC) for the "MAS" model.
static java.lang.String PAR_EPSILON
          String name of the paramater used to determine the pulse strength parameter named epsilon for the "MAS" model.
static java.lang.String PAR_INERT
          String name of the paramater used to specify the inert (or refractory) post-flash period of a firefly.
static java.lang.String PAR_MAX
          String name of the paramater used to determine maximal period to which the Fyrefly can adapt, for the "ADAPTIVE" model.
static java.lang.String PAR_MIN
          String name of the paramater used to determine minimal period to which the Fyrefly can adapt, for the "ADAPTIVE" model.
static java.lang.String PAR_MODEL
          String name of the paramater used to specify the "reaction" model.
static java.lang.String PAR_PERIOD
          String name of the parameter used to determine the period of a firefly.
static java.lang.String PAR_PREP
          String name of the paramater used to specify the preparatory pre-flash period of a firefly.
static java.lang.String PAR_PULSE_DURATION
          String name of the paramater used to specify the duration of the light impulse.
static java.lang.String PAR_RELAXATION
          String name of the paramater used to determine the relaxation parameter that measures the rate at which the Firefly will return to its natural frequency (natural_frequency is 1/period parameter).
static java.lang.String PAR_SPECIES
          String name of the parameter used to suggest the simulator you want to simulate a particular species of firefly.
static int period
           
static int prep
           
static int pulse_duration
           
static double relaxation
           
static java.lang.String species
           
 
Constructor Summary
Firefly(java.lang.String prefix)
           
 
Method Summary
 java.lang.Object clone()
           
abstract  void doFlash()
          Do Emission of a Firefly Flash.
abstract  void initSchedule()
          Run just after contructor or 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.
abstract  void receive(peersim.core.Node my_node, int my_pid, java.lang.Object received_event)
          Performed by Firefly when she senses a light impulse.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAR_SPECIES

public static final java.lang.String PAR_SPECIES
String name of the parameter used to suggest the simulator you want to simulate a particular species of firefly.

When you use this parameter, all other parameters are set automatically matching the real values for that species.

But you can also continue to use them, if your intent is to start from a real case and try out the effects of some modifications! Your params will override the original values of specified species.

Example:

protocol.myfirefly { species Malaccae period 1500 ... others }

We enlisted features found in these species:

  1. Pteroptyx
    1. Malaccae
    2. Cribellata
    3. Tener
    4. Valida
  2. Photinus
    1. Pyralis
    2. Macdermotti
    3. Versicolor
    4. Carolinus
    5. Concisus
    6. Greeni
    7. Consanguineous
    8. Consimilis
    9. Knulli
    10. Carolinus
    11. Pallens
    12. Marginellus
    13. Sabulosus
    14. Umbratus
    15. Collustrans
    16. Ignitus
  3. Photuris
    1. Frontalis
  4. Luciola
    1. Pupilla
    2. Cruciata

To specify one, grab just the 2nd name of the firefly species (Malaccae, Cribellata, ecc)

See Also:
Constant Field Values

species

public static java.lang.String species

PAR_PERIOD

public static final java.lang.String PAR_PERIOD
String name of the parameter used to determine the period of a firefly.

As in physics, its inverse is frequency. Equivalent meanings are (to cope with different literature aliases):

  1. (biological) flash period
  2. (biological) flash interval
  3. (physical) oscillator period
  4. (computer science) cycle length

To be honest, you can find any recombination of the above terms in literature ;-)

See Also:
Constant Field Values

period

public static int period

PAR_PULSE_DURATION

public static final java.lang.String PAR_PULSE_DURATION
String name of the paramater used to specify the duration of the light impulse.

A flash is not instantaneous (unlike the term suggest): its light is interely visible along its emission for fireflies (e.g flashes last 50msec in a 700msec period for some species). The remaining time (period minus pulse_duration) is usually named "dark period". Also, fireflies seems capable to recognize the form of the light emission, that is believed to be a gaussian (Buck)

In nature this value is not longer than period. But we can experiment a lot.

See Also:
Constant Field Values

pulse_duration

public static int pulse_duration

PAR_INERT

public static final java.lang.String PAR_INERT
String name of the paramater used to specify the inert (or refractory) post-flash period of a firefly.

Just after flashing, a firefly cannot re-flash because she need some time to refill the its energy subsystem capable of lighting. In this state, like the "prep" parameter, the firefly seems "refractory" to input in the sense she cannot do another flash. However, who knows if she continues (or not) to "keep in mind" flashes albeit unable to emit light?

In computer science, we can think it as a state of "resource busy": we cannot perform action for a while (here: flashing).

In nature this value is not longer than period. But we can experiment a lot.

See Also:
Constant Field Values

inert

public static int inert

PAR_PREP

public static final java.lang.String PAR_PREP
String name of the paramater used to specify the preparatory pre-flash period of a firefly.

To do flashing, a firefly must prepare it: the neural stimulus originates from brain and reach the abdomen where the light-capable subsystem builds up the chemical reaction responsible for light emission. A certain amount of time are required for this.

In this state, like the "inert" parameter, the firefly seems "refractory" to input in the sense she are full committed in preparing its flash and cannot reverse or delay the started action. However, who knows if she continues (or not) to "keep in mind" flashes albeit unable to control its irreversible flash?

In computer science, we can think it as a state of "resource busy": we cannot perform action for a while (here: undoing flash).

In nature this value is not longer than period. But we can experiment a lot.

See Also:
Constant Field Values

prep

public static int prep

PAR_MODEL

public static final java.lang.String PAR_MODEL
String name of the paramater used to specify the "reaction" model.

When receiving (input) flashes, a firefly that wants to get in sync with other can "react" by altering some of its internal parameters (phase, frequency). Consider that there are situations where input DO NOT trigger alterations. So we mean: What's the model the firefly obey?

Possible values (classification by Ermentrout 1991):

  1. ADVANCE: for "Phase Advance" - Buck 1978
  2. DELAY: for "Phase Delay" - Buck 1978
  3. MAS: for Mirollo And Strogatz's model - Mirollo and Strogatz, 1990
  4. ADAPTIVE: for Ermentrout's own adaptive model - Ermentrout 1991

See Also:
Constant Field Values

model

public static java.lang.String model

PAR_B

public static final java.lang.String PAR_B
String name of the paramater used to determine the form of the Phase Response Curve (PRC) for the "MAS" model.

See MaSModel for more info about PRC.

That value must be an integer and is interpred as a parameter named 'b' that influences the form of the PRC in the plane. (Mirollo and Strogatz 1990, Fig. 3)

b must be in the range ]0,+inf] for the definition of f(x). When b approaches 0, f(x) resembles the identity function (y=x). But when b exactly equal 0, the function shape degenerates. So, in this implementation we accept 0: when you supply it we will substitute the above f(x) with identity f(x)=x.

See Also:
MaSModel, Constant Field Values

b

public static int b

PAR_EPSILON

public static final java.lang.String PAR_EPSILON
String name of the paramater used to determine the pulse strength parameter named epsilon for the "MAS" model.

Epsilon is real number in [0,1] and models how much an incoming flash will influence the state of the receiving Firefly. In the "MAS" model the firefly flashes when PRC reaches (1,1), epsilon is a constant that makes the firefly state jump toward (1,1). The bigger epsilon, the bigger the probability that an incoming flash will trigger an immediate flash in the receiving firefly.

See Also:
MaSModel, Constant Field Values

epsilon

public static double epsilon

PAR_MAX

public static final java.lang.String PAR_MAX
String name of the paramater used to determine maximal period to which the Fyrefly can adapt, for the "ADAPTIVE" model.

Can't be smaller of the Firefly period parameter.

See Also:
AdaptiveModel, Constant Field Values

max

public static int max

PAR_MIN

public static final java.lang.String PAR_MIN
String name of the paramater used to determine minimal period to which the Fyrefly can adapt, for the "ADAPTIVE" model.

Can't be bigger of the Firefly period parameter.

See Also:
AdaptiveModel, Constant Field Values

min

public static int min

PAR_RELAXATION

public static final java.lang.String PAR_RELAXATION
String name of the paramater used to determine the relaxation parameter that measures the rate at which the Firefly will return to its natural frequency (natural_frequency is 1/period parameter).

Used for the "ADAPTIVE" model.

In literature (Ermentrout, 1991), it's named epsilon but it's not the same epsilon of the "MAS" model. So I renamed it.

See Also:
AdaptiveModel, Constant Field Values

relaxation

public static double relaxation
Constructor Detail

Firefly

public Firefly(java.lang.String prefix)
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

initSchedule

public abstract void initSchedule()
Run just after contructor or 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.


doFlash

public abstract void doFlash()
Do Emission of a Firefly Flash.

Here you implement a 'firefly flash' so you should keep in mind some characteristics of that flash:

  1. direction: firefly can decide the direction to emit light. usually is a 180° cone.

  2. sensibility: Firefly's eyes able to sense flashes within 3 meters circa (Buck).

  3. visibility: vegetation (...) can create obstacles to line-of-sight.


receive

public abstract void receive(peersim.core.Node my_node,
                             int my_pid,
                             java.lang.Object received_event)
Performed by Firefly when she senses a light impulse.

In addition to the list of things (see doFlash()) a good implementation should address these:

  1. Transmission Delay: Flashes travels at light speed in nature, but messages do not in networks.
  2. Model: The models (ADVANCE,DELAY,MAS,ADAPTIVE...) are applied here: choice how to react to the event.

The parameters are inspired by the signature of EDProtocol.processEvent(Node, int, Object) because very probably this method is called by it.