|
|||||||||
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.ct.lib.LevelCrossingDetector
public class LevelCrossingDetector
An event detector that converts continuous signals to discrete events when the continuous signal crosses a level threshold.
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.
When the trigger equals the level threshold (within the specified errorTolerance), this actor outputs a discrete event with value defaultEventValue if useEventValue is selected. Otherwise, the actor outputs a discrete event with the value as the level threshold.
This actor controls the step size such that level crossings never occur during an integration. So, this actor is only used in Continuous-Time domain.
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 boolean |
_eventNow
|
private double |
_lastTrigger
|
protected double |
_level
The level threshold this actor detects. |
private double |
_thisTrigger
|
Parameter |
defaultEventValue
A parameter that specifies the value of output events if the useEventValue parameter is checked. |
StringParameter |
direction
A parameter that can be used to limit the detected level crossings to rising or falling. |
Parameter |
errorTolerance
The parameter of error tolerance of type double. |
Parameter |
level
The parameter that specifies the level threshold. |
TypedIOPort |
output
The output port. |
TypedIOPort |
trigger
The trigger port. |
Parameter |
useDefaultEventValue
The parameter that indicates whether to use the default event value. |
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 |
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 a discrete event if level crossing happens. |
boolean |
hasCurrentEvent()
Return true if there is an event at the current time. |
void |
initialize()
Initialize the execution. |
boolean |
isOutputAccurate()
Return true if there is no event detected during the current step size. |
boolean |
isStateAccurate()
Always return true because this actor is not involved in resolving states. |
boolean |
postfire()
Prepare for the next iteration, by making the current trigger token to be the history trigger token. |
double |
predictedStepSize()
Return the maximum Double, since this actor does not predict step size. |
void |
preinitialize()
Make sure the actor runs inside a CT domain. |
double |
refinedStepSize()
Return the refined step size if there is a missed event, otherwise return the current step size. |
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.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 Parameter defaultEventValue
public StringParameter direction
public Parameter errorTolerance
public Parameter level
public TypedIOPort output
public TypedIOPort trigger
public Parameter useDefaultEventValue
protected double _level
private boolean _detectRisingCrossing
private boolean _detectFallingCrossing
private double _errorTolerance
private boolean _eventMissed
private boolean _eventNow
private double _lastTrigger
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
The value of this event may be the specified level, or the default event value if the usingDefaultEventValue is configured true (checked).
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 boolean hasCurrentEvent()
hasCurrentEvent
in interface CTEventGenerator
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor
IllegalActionException
- If thrown by the super class.public boolean isOutputAccurate()
isOutputAccurate
in interface CTStepSizeControlActor
public boolean isStateAccurate()
isStateAccurate
in interface CTStepSizeControlActor
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class AtomicActor
IllegalActionException
- If thrown by the super class.public double predictedStepSize()
predictedStepSize
in interface CTStepSizeControlActor
public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class AtomicActor
IllegalActionException
- If the director is not
a CTDirector or the parent class throws it.public double refinedStepSize()
refinedStepSize
in interface CTStepSizeControlActor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |