Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

AgentRelay


Link to the AgentRelay module (source code documentation)

Introduction

The AgentRelay module contains code which has the following responsiblities:

events.png

Example of events in an agent with time unit one hour and latency one hour.

Coordinating the internal time and scheduling and handling time events for the agent

Each agent must have a notion of time to be able to plan and execute. The IDEA agent represents time in the datastructure IDEA::Time and maintains a clock via IDEA::AgentTimingService. Time in an agent is discrete and events in an agent can only happen and be schedules at multiples of the latency. An IDEA agent is an event driven system and we distinguish the following high level events:

Wakeup event

A wakeup event is a scheduled event to wakeup the agent to execute one reactive planning cycle. A wakeup event is always scheduled at the end of a cycle by determining the next earliest possible event which might require planning, see Determinining the next event time

If no message comes in from an external system the IDEA agent will be idle untill the next wakeup event. In case a message does come in via the IDEA::AgentRelay the IDEA agent will cancel the current scheduled wakeup event and schedule a new wakeup as soon as possible (the next tick).

executeonecycle.png

UML sequence diagram of IDEA::PlanRunner::executeOneCycle

Reboot event

A reboot event is a scheduled event by the IDEA::PlanRunner::executeOneCycle to limit the time one cycle can take at most (which is one latency). In case a cycle takes more than one latency the reboot event is triggered and handled in a seperate thread and it will simply end the lifecycle of the complete agent. If this happens the following message will appear at the end of the log file:

[ AGENT-NAME SharedTimingServiceImpl XXXXXX XXXXXX XXXXXX ] *** Requesting reactive planner to stop!
Error:
  File           : ReactivePlannerImpl.cc
  Line           : 924
  Message        : ** Aborting the agent due to a timeout. A timeout happens because the reactive-planner can not finish reacting within a latency.

Determinining the next event time

Given the current time of the database (PslDatabase::getTime) and the current state of the system we can query the database to determine the next wakeup time for the agent.

For each timeline in the agent we take the token which is currently executing and is enabled (see executing token and enabled token). Of these executing tokens we take the token with the earliest possible time something can happen which is the latest end time for uncontrollable tokens and the earliest end time for controllable tokens (see controllable token).

Coordinating the invocation of the Reactiveplanner

Coordinating message traffic to and from the agent

An IDEA agent communicates with external systems via incomming and outgoing messages. Incomming messages can come in at any given time and they will only be processed at the beginning of an execution cycle by the reactive planner and we schedule execution cycles only to happen at multiples of the latency (see Wakeup event). Outgoing messages are send at the end of an execution cycle by the IDEA::PlanRunner. An execution cycle is limited to take at most one latency (see Reboot event). This means the worst case turn around time to react to an incoming message is two latencies, one latency before we start processing the message and at most one latency before we send out a message as a response.

At the end of an execution cycle the IDEA agent (IDEA::PlanRunner) will query the state of the plan database and send out the following messages:


Contact information
© IDEA
Generated on Mon Jan 30 17:48:06 2006 for IDEA.