|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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.domains.continuous.lib.LevelCrossingDetector
public class LevelCrossingDetector
An event detector that converts continuous signals to discrete events when the input trigger signal crosses a threshold specified by the level parameter. The direction parameter can constrain the actor to detect only rising or falling transitions. It has three possible values, "rising", "falling", and "both", where "both" is the default. This actor will produce an output whether the input is continuous or not. That is, if a discontinuity crosses the threshold in the right direction, it produces an output at the time of the discontinuity. If the input is continuous, then the output is produced when the input is within errorTolerance of the level. The value of the output is given by the value parameter, which by default has the value of the level parameter.
This actor will not produce an event on its very first firing. If you need an output at time zero, then you need generate a level crossing discontinuity at time zero.
This actor will also not produce an event if the current microstep is 0. In that case, the output is postponed by one microstep. This ensures that the output signal, which is discrete, satisfies the piecewise continuity constraint, and is absent at microstep 0.
Red (hyzheng) |
Yellow (hyzheng) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.Entity |
---|
Entity.ContainedObjectsIterator |
Field Summary | |
---|---|
private boolean |
_detectFallingCrossing
|
private boolean |
_detectRisingCrossing
|
private double |
_errorTolerance
|
private boolean |
_eventMissed
|
private double |
_lastTrigger
|
protected double |
_level
The level threshold this actor detects. |
private Time |
_postponed
|
private boolean |
_postponedOutputProduced
|
private double |
_thisTrigger
|
StringParameter |
direction
A parameter that can be used to limit the detected level crossings to rising or falling. |
Parameter |
errorTolerance
The error tolerance specifying how close the value of a continuous input needs to be to the specified level to produce the output event. |
Parameter |
level
The parameter that specifies the level threshold. |
TypedIOPort |
output
The output port. |
TypedIOPort |
trigger
The trigger port. |
Parameter |
value
The output value to produce when a level-crossing is detected. |
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 | |
---|---|
LevelCrossingDetector(CompositeEntity container,
java.lang.String name)
Construct an actor in the specified container with the specified name. |
Method Summary | |
---|---|
void |
attributeChanged(Attribute attribute)
Update the attribute if it has been changed. |
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
fire()
Produce an output event if the current input compared to the input on the last iteration indicates that a level crossing in the appropriate direction has occurred, if the time is within errorTolerance of the time at which the crossing occurs. |
void |
initialize()
Initialize the execution. |
boolean |
isStepSizeAccurate()
Return false if with the current step size we miss a level crossing. |
boolean |
postfire()
Prepare for the next iteration, by making the current trigger token to be the history trigger token. |
void |
preinitialize()
Make sure the actor runs with a ContinuousDirector. |
double |
refinedStepSize()
Return the refined step size if there is a missed event, otherwise return the current step size. |
double |
suggestedStepSize()
Return the maximum Double value. |
Methods inherited from class ptolemy.actor.TypedAtomicActor |
---|
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints |
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 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, prefire, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, removeInitializable, wrapup |
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 StringParameter direction
public Parameter errorTolerance
public Parameter level
public Parameter value
public TypedIOPort output
public TypedIOPort trigger
protected double _level
private boolean _detectRisingCrossing
private boolean _detectFallingCrossing
private double _errorTolerance
private boolean _eventMissed
private double _lastTrigger
private Time _postponed
private boolean _postponedOutputProduced
private double _thisTrigger
Constructor Detail |
---|
public LevelCrossingDetector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The subsystem that this actor is lived inname
- The actor's name
IllegalActionException
- If the entity cannot be contained
by the proposed container.
NameDuplicationException
- If name coincides with
an entity already in the container.Method Detail |
---|
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that has changed.
IllegalActionException
- If the attribute change failed.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class AtomicActor
workspace
- The workspace for the new object.
java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor
IllegalActionException
- If can not get token from the trigger
port or can not send token through the output port.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor
IllegalActionException
- If thrown by the super class.public boolean isStepSizeAccurate()
isStepSizeAccurate
in interface ContinuousStepSizeController
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class AtomicActor
IllegalActionException
- If thrown by the super class.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class AtomicActor
IllegalActionException
- If the director is not
a ContinuousDirector or the parent class throws it.public double refinedStepSize()
refinedStepSize
in interface ContinuousStepSizeController
public double suggestedStepSize()
suggestedStepSize
in interface ContinuousStepSizeController
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |