Federated app constructor. The primary difference from an App constructor is the federateID and the rtiPort.
Optional
success: (() => void)Optional argument. Called when the FederatedApp exits with success.
Optional
failure: (() => void)Optional argument. Called when the FederatedApp exits with failure.
Readonly
__dummyThis reactor's dummy action.
Protected
_activeIndicates whether this reactor is active (meaning it has reacted to a startup action), or not (in which case it either never started up or has reacted to a shutdown action).
Readonly
_alarmProtected
_dependencyThis graph has in it all the dependencies implied by this container's ports, reactions, and connections.
Protected
_erroredProtected
Optional
_errorProtected
_immediateReference to "immediate" invocation of next.
Protected
_isStores whether the last received TAG (Tag Advance Grant) was provisional. Every federate starts out assuming that it has been granted a PTAG at the start time, or if it has no upstream federates, a TAG.
Protected
_keepIndicates whether the program should continue running once the event queue is empty.
Protected
_keyA symbol that identifies this component, and it also used to selectively grant access to its privileged functions.
Readonly
_nameProtected
Readonly
_reactionQPriority set that keeps track of reactions at the current Logical time.
Readonly
_uuidOptional callback to be used to indicate a failed execution.
Readonly
shutdownThis reactor's shutdown action.
Readonly
startupThis reactor's startup action.
Optional callback to be used to indicate a successful execution.
Protected
utilInner class that provides access to utilities that are safe to expose to reaction code.
Static
pathProtected
_addAdd a dummy event to the event queue. Currently, the sole usage of this is to ensure LET to be sent to the RTI when there is any physical action triggering output port(s) in federated execution.
The tag at which this dummy event occurs.
Protected
_advanceSet the current tag to be the next tag.
Protected
_analyzeAnalyze the dependencies between reactions in this app.
Assign priorities that encode the precedence relations between reactions. If there exist circular dependencies, throw an exception. This method should only be invoked prior to the start of execution, never during execution.
Protected
_cancelProtected
_canReturn whether the next event can be handled, or handling the next event has to be postponed to a later time.
If this federated app has not received a sufficiently large time advance grant (TAG) from the RTI for the next event, send it a Next Event Time (NET) message and return. _next() will be called when a new greatest TAG is received. The NET message is not sent if the connection to the RTI is closed. FIXME: what happens in that case? Will next be called?
Protected
_connectConnect a source port to a downstream destination port. If a source is a regular port, then the type variable of the source has to be a subtype of the type variable of the destination. If the source is a caller port, then the destination has to be a callee port that is effectively a subtype of the caller port. Because functions have a contra-variant subtype relation, the arguments of the caller side must be a subtype of the callee's, and the return value of the callee's must be a subtype of the caller's.
Protected
_connectProtected
_connectRemove the given reactor and its connections from this container if the key matches.
Protected
_determineSet the logical start time of the execution according to the given time value. If an execution timeout is defined, also determine the end of execution is as the start time plus the execution timeout. This method also marks the app as "active" and initializes any timers that may have been created during the course of this app's instantiation.
The beginning of this app's execution. The end of execution is determined relative to this TimeValue is a timeout has been set.
Protected
_disconnectProtected
_finishProtected
_getReturn a dependency graph consisting of only this reactor's own ports and the dependencies between them.
Protected
_getProtected
_getProtected
_getIf the given component is owned by this reactor, look up its key and return it. Otherwise, if a key has been provided, and it matches the key of this reactor, also look up the component's key and return it. Otherwise, if the component is owned by a reactor that is owned by this reactor, request the component's key from that reactor and return it. If the component is an action, this request is not honored because actions are never supposed to be accessed across levels of hierarchy.
The component to look up the key for.
Optional
key: symbolThe key that verifies the containment relation between this reactor and the component, with at most one level of indirection.
Protected
_getProtected
_getProtected
_getProtected
_getRecursively collect the local dependency graph of each contained reactor and merge them all in one graph.
The recursion depth can be limited via the depth parameter. A depth of 0 will only return the local dependency graph of this reactor, a depth of 1 will merge the local graph only with this reactor's immediate children, etc. The default dept is -1, which will let this method recurse until it has reached a reactor with no children.
Some additional constraits are added to guarantee the following:
The depth of recursion.
Protected
_getProtected
_getProtected
_initializeProtected
_initializeConfirm whether or not this component is contained by the given reactor.
The presumptive container of this component.
Confirm whether or not this component is contained by the container of the given reactor.
The container presumptive container of the container of this component.
Report whether the given port is downstream of this reactor. If so, the given port can be connected to with an output port of this reactor.
Report whether this component has been registered with its container or not. In principle, all components should have a container, but at the time of their construction there is a brief period where they are not. This is the only moment that a component is allowed register with its container.
Report whether the given port is upstream of this reactor. If so, the given port can be connected to an input port of this reactor.
Protected
_iterationProtected
_linkProtected
_loadProtected
_reactReceive the runtime object from the container of this reactor. Invoking this method in any user-written code will result in a runtime error.
The runtime object handed down from the container.
Add a component to this container.
A component that is created as part of this reactor invokes this method upon creation.
The component to register.
The component's key.
Protected
_requestProtected
_setProtected
_setSetter for _endOfExecution to be used used by the subclass, FederatedApp.
Protected
_shutdownRegister this federated app with the RTI and request a start time. This function registers handlers for the events produced by the federated app's rtiClient and connects to the RTI. The federated app cannot schedule the start of the runtime until the rtiClient has received a start time message from the RTI.
Protected
_startProtected
_startProtected
_unplugProtected
_unsetReport a timer to the app so that it gets unscheduled.
The timer to report to the app.
Protected
_unsetProtected
addRest
...args: ArgList<T>Optional
deadline: TimeValueRest
...args: ArgList<T>Protected
addAdd a reaction to this reactor. Each newly added reaction will acquire a dependency either on the previously added reaction, or on the last added mutation (in case no reactions had been added prior to this one). A reaction is specified by a list of triggers, a list of arguments, a react function, an optional deadline, and an optional late function (which represents the reaction body of the deadline). All triggers a reaction needs access must be included in the arguments.
Rest
...args: ArgList<T>Optional
deadline: TimeValueRest
...args: ArgList<T>Returns true if a given source port can be connected to the given destination port, false otherwise. Valid connections must: (1) adhere to the scoping rules and connectivity constraints of reactors; and (2) not introduce cycles.
The scoping rules of reactors can be summarized as follows:
Protected
nextProtected
prevRegister a network receiver reactors. It must be registered so it is known by this FederatedApp and used when add edges for TPO levels and may be used when a message for the associated port has been received via the RTI.
Unfortunately, the data type of the action has to be unknown
,
meaning that the type checker cannot check whether uses of the action are type safe.
In an alternative design, type information might be preserved. TODO(marten): Look into this.
The designated network receiver reactor.
Register a network sender reactors. It must be registered so it is known by this FederatedApp to be used when register portAbsentReaction and add edges for TPO levels.
The designated network sender reactor
Protected
schedulableSend a logical time complete message to the RTI. This should be called whenever this federate is ready to advance beyond the given logical time.
Send a message to a potentially remote federate's port via the RTI. This message is untimed, and will be timestamped by the destination federate when it is received.
The message encoded as a Buffer.
The ID of the federate intended to receive the message.
The ID of the federate's port intended to receive the message.
Send a next event time message to the RTI. This should be called when this federated app is unable to advance logical time beause it has not yet received a sufficiently large time advance grant.
The time to which this federate would like to advance logical time.
Send a port absent message to the destination port, informing the remote federate that the current federate will not produce an event on this network port at the current logical time.
The ID of the receiving port.
The offset applied to the timestamp using after. The additional delay will be greater or equal to zero if an after is used on the connection. If no after is given in the program, NEVER is passed.
Send the RTI a stop request message.
Send the RTI a stop request reply message.
Send a timed message to a potentially remote FederateInPort via the RTI. This message is timed, meaning it carries the logical timestamp of this federate when this function is called.
Static
keyStatic
keyGiven a component and its container (the global object if the component
is an App
), return the key of the entry that matches the component.
a component of which the object is assumed to be its container
the assumed container of the component
the key of the entry that matches the component
Static
key
A federated app is an app containing federates as its top level reactors. A federate is a component in a distributed reactor execution in which reactors from the same (abstract) model run in distinct networked processes. A federated app contains the federates designated to run in a particular process. The federated program is coordinated by the RTI (Run Time Infrastructure). Like an app, a federated app is the top level reactor for a particular process, but a federated app must follow the direction of the RTI for beginning execution, advancing time, and exchanging messages with other federates.
Note: There is no special class for a federate. A federate is the name for a top level reactor of a federated app.