DRCL J-Sim API

drcl.inet.sensorsim
Class BatteryContract

java.lang.Object
  extended bydrcl.comp.Contract
      extended bydrcl.inet.sensorsim.BatteryContract

public class BatteryContract
extends Contract

This class implements the contract between the battery model and the CPU and radio models.

Version:
1.0, 12/19/2003
Author:
Ahmed Sobeih

Nested Class Summary
static class BatteryContract.Message
          This class implements the underlying message of the contract.
 
Field Summary
static int GET_REMAINING_ENERGY
           
static BatteryContract INSTANCE
           
static int SET_CONSUMER_CURRENT
           
 
Fields inherited from class drcl.comp.Contract
Role_INITIATOR, Role_PEER, Role_REACTOR
 
Constructor Summary
BatteryContract()
           
BatteryContract(int role_)
           
 
Method Summary
static java.lang.Object createGetRemainingEnergyRequest()
          Builds the message that is used to get the remaining energy.
static java.lang.Object createSetConsumerCurrentRequest(int consumer_id, double current)
          Builds the message that is used to report the consumed current.
 java.lang.Object getContractContent()
          Returns the content of this contract (format?).
 java.lang.String getName()
           
static double getRemainingEnergy(Port out_)
          Gets the remaining energy.
static void setConsumerCurrent(int consumer_id, double current, Port out_)
          Reports the current consumed by a power consumer.
 
Methods inherited from class drcl.comp.Contract
getRole, match, setRole
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final BatteryContract INSTANCE

GET_REMAINING_ENERGY

public static final int GET_REMAINING_ENERGY
See Also:
Constant Field Values

SET_CONSUMER_CURRENT

public static final int SET_CONSUMER_CURRENT
See Also:
Constant Field Values
Constructor Detail

BatteryContract

public BatteryContract()

BatteryContract

public BatteryContract(int role_)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class Contract

getContractContent

public java.lang.Object getContractContent()
Description copied from class: Contract
Returns the content of this contract (format?).

Specified by:
getContractContent in class Contract

setConsumerCurrent

public static void setConsumerCurrent(int consumer_id,
                                      double current,
                                      Port out_)
Reports the current consumed by a power consumer.


createSetConsumerCurrentRequest

public static java.lang.Object createSetConsumerCurrentRequest(int consumer_id,
                                                               double current)
Builds the message that is used to report the consumed current.


getRemainingEnergy

public static double getRemainingEnergy(Port out_)
Gets the remaining energy.


createGetRemainingEnergyRequest

public static java.lang.Object createGetRemainingEnergyRequest()
Builds the message that is used to get the remaining energy.


DRCL J-Sim API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~