next up previous
Next: Querying an event class Up: Entities and Events Previous: Access to the detailed

Adding probes to entities

A probe is used to monitor some internal property of an entity, such as a voltage or ion concentration. The technique is to create an extra output port for each probe, with an event generator to convert the internal state into a stream of events.

--- ( in script reader ) ---
   class AddProbe extends EntityQuery { // a query, as it returns PortID
     AddProbe( CompartmentID cid, EventClass ec ); 
     Object query(NeosimEntity e) {
       return e.addOutputPort( ec );
     }
   }
   // e = lookup entity to query
   // cid = lookup compartment to probe
   EventClass ec = lookupEventClass("doubleEvent");
   PortID probePort = queryEntity( e, new AddProbe(cid,ec) );

   // now connect probe port to port 1 of a monitor entity
   connect( new SingleConnection(e, probePort, monitor, 1, 10.0) );

Another way to query the state of an entity on a regular basis would be to create another entity which sends repeated queries to the entity. The advantage of this is that there is no need to make an extra connection, and no need for the probed entity to be capable of generating the extra events; the disadvantage is that this technique is slightly less efficient.



Fred Howell
8/15/1999