Package xdevs.core.modeling
Class Atomic
- java.lang.Object
-
- xdevs.core.modeling.Component
-
- xdevs.core.modeling.Atomic
-
- Direct Known Subclasses:
Coupled2Atomic
,DevStoneAtomic
,DevStoneGenerator
,Generator
,Machine
,Processor
,Transducer
public abstract class Atomic extends Component
Abstract class for all atomic components in the DEVS formalism. An atomic component is a model that can be connected to other components to form a hierarchical model. It has input and output ports to communicate with other components.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activate()
Method to activate the model with sigma 0.void
deltcon(double e)
abstract void
deltext(double e)
External transition method of the atomic model.abstract void
deltint()
Internal transition method of the atomic model.String
getPhase()
Method to get the phase of the model.double
getSigma()
Method to get the time until the next internal transition of the model.void
holdIn(String phase, double sigma)
Method to hold the model in a given phase for a given time.abstract void
lambda()
Output function of the atomic model.void
passivate()
Method to passivate the model with sigma infinity.void
passivate(String phase)
Method to passivate the model in a given phase.void
passivateIn(String phase)
Deprecated.boolean
phaseIs(String phase)
Method to check if the model is in a given phase.void
resume(double e)
Method to updated sigma in the external transition function.void
setPhase(String phase)
Method to set the phase of the model.void
setSigma(double sigma)
Method to set the time until the next internal transition of the model.String
showState()
Method to get the state of the model.double
ta()
Method to get the time until the next internal transition of the model.String
toXml()
Method to get the XML representation of the model.-
Methods inherited from class xdevs.core.modeling.Component
addInPort, addOutPort, exit, getInPort, getInPorts, getName, getOutPort, getOutPorts, getParent, initialize, isInputEmpty, setParent, toString
-
-
-
-
Field Detail
-
phase
protected String phase
The phase of the atomic model. The phase is used to determine the behavior of the model. Default values can be passive or active.
-
sigma
protected double sigma
The time until the next internal transition of the model. The time is used to determine when the model will change its state. The time is set to infinity if the model is passive.
-
-
Constructor Detail
-
Atomic
public Atomic(String name)
Constructor of the atomic model.- Parameters:
name
- The name of the atomic model.
-
Atomic
public Atomic()
Constructor of the atomic model.
-
-
Method Detail
-
ta
public double ta()
Method to get the time until the next internal transition of the model.- Returns:
- The time until the next internal transition of the model.
-
deltint
public abstract void deltint()
Internal transition method of the atomic model. This method is called when the time until the next internal transition of the model is zero.
-
deltext
public abstract void deltext(double e)
External transition method of the atomic model. This method is called when the model receives an input from another model.- Parameters:
e
- The time elapsed since the last internal transition of the model.
-
deltcon
public void deltcon(double e)
-
lambda
public abstract void lambda()
Output function of the atomic model. This method is called when the model has an output to send to another model.
-
resume
public void resume(double e)
Method to updated sigma in the external transition function.- Parameters:
e
- The time elapsed since the last internal transition of the model.
-
holdIn
public void holdIn(String phase, double sigma)
Method to hold the model in a given phase for a given time.- Parameters:
phase
- The phase to hold the model in.sigma
- The time to hold the model in the phase.
-
activate
public void activate()
Method to activate the model with sigma 0.
-
passivate
public void passivate()
Method to passivate the model with sigma infinity.
-
passivate
public void passivate(String phase)
Method to passivate the model in a given phase.- Parameters:
phase
- The phase to passivate the model in.
-
passivateIn
@Deprecated public void passivateIn(String phase)
Deprecated.This method is deprecated. Use passivate(String phase) instead.- Parameters:
phase
- The phase to passivate the model in.
-
phaseIs
public boolean phaseIs(String phase)
Method to check if the model is in a given phase.- Parameters:
phase
- The phase to check.- Returns:
- True if the model is in the given phase, false otherwise.
-
getPhase
public String getPhase()
Method to get the phase of the model.- Returns:
- The phase of the model.
-
setPhase
public final void setPhase(String phase)
Method to set the phase of the model.- Parameters:
phase
- The phase to set the model to.
-
getSigma
public double getSigma()
Method to get the time until the next internal transition of the model.- Returns:
- The time until the next internal transition of the model.
-
setSigma
public final void setSigma(double sigma)
Method to set the time until the next internal transition of the model.- Parameters:
sigma
- The time until the next internal transition of the model.
-
showState
public String showState()
Method to get the state of the model.- Returns:
- The state of the model.
-
-