Package ptolemy.domains.de.test
Class SuperdenseTimeTest
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- ptolemy.domains.de.test.SuperdenseTimeTest
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class SuperdenseTimeTest extends TypedAtomicActor
A test actor illustrating a potential bug in DE in its handling of superdense time. In particular, the outputs of this actor have no causal dependence on the inputs, and hence no delay is needed in a feedback loop that feeds outputs back to the inputs. Inputs are read and processed in postfire(). However, if the output is fed directly back to an input, then the input used to be read in the same iteration in which the output was produced. If, however, there is an intervening actor in the feedback loop, then the input would be read in the next iteration. This leads to strange behavior where the presence of even a no-op actor (like a unit gain) changes the behavior of the model.What is the solution here?
This actor first outputs nothing. In postfire(), it reads inputs and sums them, and if any inputs were present, it requests a new firing. In that firing, it produces the calculated sum. After 10 firings, it stops producing outputs.
- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Red (ltrnc)
- Pt.ProposedRating:
- Red (ltrnc)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description TypedIOPort
in1
The inputs and output.TypedIOPort
in2
The inputs and output.TypedIOPort
in3
The inputs and output.TypedIOPort
out
The inputs and output.-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description SuperdenseTimeTest(CompositeEntity container, java.lang.String name)
Create an instance of the actor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fire()
Respond to an HTTP request.CausalityInterface
getCausalityInterface()
Override the base class to return a causality interface that indicates that no output depends (immediately) on any input, and that also puts both input ports in an equivalence class.void
initialize()
Set the output value to 0.0.boolean
postfire()
Read the inputs and sum them.-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
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
_addPort, _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, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, 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, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, 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, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
in1
public TypedIOPort in1
The inputs and output.
-
in2
public TypedIOPort in2
The inputs and output.
-
in3
public TypedIOPort in3
The inputs and output.
-
out
public TypedIOPort out
The inputs and output.
-
-
Constructor Detail
-
SuperdenseTimeTest
public SuperdenseTimeTest(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create an instance of the actor.- Parameters:
container
- The containername
- The name.- Throws:
IllegalActionException
- If the superclass throws it.NameDuplicationException
- If the super
-
-
Method Detail
-
getCausalityInterface
public CausalityInterface getCausalityInterface()
Override the base class to return a causality interface that indicates that no output depends (immediately) on any input, and that also puts both input ports in an equivalence class.- Specified by:
getCausalityInterface
in interfaceActor
- Overrides:
getCausalityInterface
in classAtomicActor<TypedIOPort>
- Returns:
- A representation of the dependencies between input ports and output ports.
-
fire
public void fire() throws IllegalActionException
Respond to an HTTP request. If there is a response at the input port, then record that response and notify the servlet thread that a response is ready. Otherwise, if the servlet has received an HTTP request, then produce on the output ports the details of the request.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If sending the outputs fails.
-
initialize
public void initialize() throws IllegalActionException
Set the output value to 0.0.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If the superclass throws it.
-
postfire
public boolean postfire() throws IllegalActionException
Read the inputs and sum them.- Specified by:
postfire
in interfaceExecutable
- Overrides:
postfire
in classAtomicActor<TypedIOPort>
- Returns:
- True if a stop has not been requested.
- Throws:
IllegalActionException
- Not thrown in this base class.
-
-