|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTypedAtomicActor
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
|
Field Summary | |
---|---|
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 |
Parameter |
host
The host and port to make the connection to, i.e., where the Model Railway interface program is running. |
TypedIOPort |
occupied
This will hold ArrayTokens of occupied values of not occupied(0) or occupied(1) |
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) |
Parameter |
port
|
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) |
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 .. |
TypedIOPort |
trigger
This may trigger the actor in a DE domain. |
Constructor Summary | |
---|---|
ModelRailwayIO(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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Parameter host
public Parameter port
public TypedIOPort trigger
public TypedIOPort tracks
public TypedIOPort points
public TypedIOPort signals
public TypedIOPort contact
public TypedIOPort occupied
Constructor Detail |
---|
public ModelRailwayIO(CompositeEntity container, String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor.
IllegalActionException
- If the actor cannot be contained
by the proposed container.
NameDuplicationException
- If the container already has an
actor with this name.Method Detail |
---|
public void fire() throws IllegalActionException
IllegalActionException
- If calling send() or super.fire()
throws it.public void initialize() throws IllegalActionException
IllegalActionException
- If the parent class throws it.public void wrapup() throws IllegalActionException
IllegalActionException
- Not thrown in this base class.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |