5using System.Threading.Tasks;
17 private bool isPeriodic;
62 public override Task
FromXml(XmlElement Definition)
67 return base.FromXml(Definition);
83 isPeriodic = this.isPeriodic
92 return Task.CompletedTask;
95 private void TimerCallback(
object State)
107 DateTime Now = DateTime.Now;
108 DateTime TP = Now + this.period;
109 TimeSpan TS = TP - Now;
111 this.timer =
new Timer(this.TimerCallback,
null, TS, TS);
114 return Task.CompletedTask;
122 this.timer?.Dispose();
125 return Task.CompletedTask;
137 Output.Write(
"note right of ");
139 Output.Write(
" : Elapses periodically every ");
141 Values.Duration.ExportText(this.period, Output);
Root node of a simulation model
bool ExternalEvent(IExternalEventsNode Source, string Name, params KeyValuePair< string, object >[] Arguments)
Method called when an external event has been received.
Abstract base class for actors
string InstanceId
ID of actor instance.
int InstanceIndex
Actor instance index.
override string Id
ID of actor.
Represents an internal clock.
override Task FinalizeInstance()
Finalizes an instance of an actor.
TimerActor(ISimulationNode Parent, Model Model, int InstanceIndex, string InstanceId)
Represents an internal clock.
TimerActor(ISimulationNode Parent, Model Model)
Represents an internal clock.
override Task FromXml(XmlElement Definition)
Sets properties and attributes of class in accordance with XML definition.
override Task InitializeInstance()
Initializes an instance of an actor.
override Task StartInstance()
Starts an instance of an actor.
override void AnnotateActorUseCaseUml(StreamWriter Output, string Id)
Allows the actor to add notes related to the actor in use case diagrams.
override Task< Actor > CreateInstanceAsync(int InstanceIndex, string InstanceId)
Creates an instance of the actor.
override string LocalName
Local name of XML element defining contents of class.
override ISimulationNode Create(ISimulationNode Parent, Model Model)
Creates a new instance of the node.
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
ISimulationNode Parent
Parent node in the simulation model.
Represents a duration value, as defined by the xsd:duration data type: http://www....
static readonly Duration Zero
Zero value