|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.kiel.ModelRailwayIO
public class ModelRailwayIO
Interacts with the Model Railway (and its simulation) of the Department of Computer Science of Kiel University, Germany. The Model Railway can be found here: http://www.informatik.uni-kiel.de/~railway/ The simulation of the Model Railway can be found here: http://rtsys.informatik.uni-kiel.de/~biblio/downloads/theses/cmot-st.pdf Input track, point and signal commands as RecordTokens of the following form: port={track2={motormode=1,speed=100}} where motormode can be off(0), primary(1), secondary(2) or brake(3) DEFAULT is primary(1) and speed is a value between 0 .. 100 DEFAULT is 0 port={point2={turn=0}} where a turn value of 0 indicates straight and a turn value of 1 indicates turn position DEFAULT is straight(0) port={signal2a={lights=2}} where a means first and b means second in default driving direction of the selected track (here 2) and lights can be off(0), red(1), yellowgreen(2), green(4) DEFAULT is red(1) Output of this actor are two ArrayTokens contact and occupied that can be used to obtain information about the triggered reed contacts or the occupied track segments with the following meaning of values: contact: not triggered(-1), triggered first(0) and triggered second(1) in default driving direction occupied: not occupied(0) or occupied(1)
Nested Class Summary | |
---|---|
class |
ModelRailwayIO.RailwayInterface
|
Nested classes/interfaces inherited from class ptolemy.kernel.Entity |
---|
ptolemy.kernel.Entity.ContainedObjectsIterator |
Field Summary | |
---|---|
ptolemy.actor.TypedIOPort |
contact
This will hold ArrayTokens of reed contact values of not triggered(-1), triggered first(0) and triggered second(1) in default driving direction |
ptolemy.data.expr.Parameter |
host
The host and port to make the connection to, i.e., where the Model Railway interface program is running. |
ptolemy.actor.TypedIOPort |
occupied
This will hold ArrayTokens of occupied values of not occupied(0) or occupied(1) |
ptolemy.actor.TypedIOPort |
points
Set a point using RecordTokens like port={point21={turn=0}} where a turn value of 0 indicates straight and a turn value of 1 indicates turn position DEFAULT is straight(0) |
ptolemy.data.expr.Parameter |
port
|
ptolemy.actor.TypedIOPort |
signals
Set a signal using RecordTokens like port={signal2a={lights=2}} where a means first and b second signal in default driving direction of the selected track (here 2) and lights can be off(0), red(1), yellowgreen(2), green(4) DEFAULT is red(1) |
ptolemy.actor.TypedIOPort |
tracks
Set the speed of some tracks using RecordTokens like port={track5={motormode=1,speed=100} where motormode can be off(0), primary(1), secondary(2) or brake(3) DEFAULT is primary(1) and speed is a value between 0 .. |
ptolemy.actor.TypedIOPort |
trigger
This may trigger the actor in a DE domain. |
Fields inherited from class ptolemy.actor.AtomicActor |
---|
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.actor.Executable |
---|
COMPLETED, NOT_READY, STOP_ITERATING |
Constructor Summary | |
---|---|
ModelRailwayIO(ptolemy.kernel.CompositeEntity container,
String name)
Construct an actor with the given container and name. |
Method Summary | |
---|---|
void |
fire()
Collect the trigger Token first, then process possible speed, point or signal commands. |
void |
initialize()
Set the RailwayInterface and open a TCP connection to the Model Railway interface program w/ the given host and port parameters. |
void |
wrapup()
Terminate the TCP connection of the Model Railway interface. |
Methods inherited from class ptolemy.actor.TypedAtomicActor |
---|
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints |
Methods inherited from class ptolemy.actor.AtomicActor |
---|
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate |
Methods inherited from class ptolemy.kernel.ComponentEntity |
---|
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
---|
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.InstantiableNamedObj |
---|
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition |
Methods inherited from class ptolemy.kernel.util.NamedObj |
---|
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.actor.Actor |
---|
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList |
Methods inherited from interface ptolemy.actor.Executable |
---|
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, preinitialize, removeInitializable |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getDisplayName, getFullName, getName, getName, setName |
Methods inherited from interface ptolemy.kernel.util.Derivable |
---|
getDerivedLevel, getDerivedList, propagateValue |
Field Detail |
---|
public ptolemy.data.expr.Parameter host
public ptolemy.data.expr.Parameter port
public ptolemy.actor.TypedIOPort trigger
public ptolemy.actor.TypedIOPort tracks
public ptolemy.actor.TypedIOPort points
public ptolemy.actor.TypedIOPort signals
public ptolemy.actor.TypedIOPort contact
public ptolemy.actor.TypedIOPort occupied
Constructor Detail |
---|
public ModelRailwayIO(ptolemy.kernel.CompositeEntity container, String name) throws ptolemy.kernel.util.NameDuplicationException, ptolemy.kernel.util.IllegalActionException
container
- The container.name
- The name of this actor.
ptolemy.kernel.util.IllegalActionException
- If the actor cannot be contained
by the proposed container.
ptolemy.kernel.util.NameDuplicationException
- If the container already has an
actor with this name.Method Detail |
---|
public void fire() throws ptolemy.kernel.util.IllegalActionException
fire
in interface ptolemy.actor.Executable
fire
in class ptolemy.actor.AtomicActor
ptolemy.kernel.util.IllegalActionException
- If calling send() or super.fire()
throws it.public void initialize() throws ptolemy.kernel.util.IllegalActionException
initialize
in interface ptolemy.actor.Initializable
initialize
in class ptolemy.actor.AtomicActor
ptolemy.kernel.util.IllegalActionException
- If the parent class throws it.public void wrapup() throws ptolemy.kernel.util.IllegalActionException
wrapup
in interface ptolemy.actor.Initializable
wrapup
in class ptolemy.actor.AtomicActor
ptolemy.kernel.util.IllegalActionException
- Not thrown in this base class.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |