3using System.Threading.Tasks;
16 private string distributionId;
19 private int guardLimit;
61 public override Task
FromXml(XmlElement Definition)
63 this.distributionId =
XML.
Attribute(Definition,
"distribution");
64 this.guardLimit =
XML.
Attribute(Definition,
"guardLimit", 1000);
66 if (Definition.HasAttribute(
"guard"))
67 this.guard =
new Expression(Definition.GetAttribute(
"guard"));
71 return base.FromXml(Definition);
80 throw new Exception(
"Distribution not found: " + this.distributionId);
82 return base.Initialize();
93 int n = this.distribution.
CheckTrigger(t1, t2, NrCycles);
113 base.ExportUseCaseData(Output, Index);
115 if (!(this.guard is
null))
117 Output.Write(
"note left of UC");
118 Output.WriteLine(Index.ToString());
119 Output.Write(this.distributionId);
120 Output.WriteLine(
" is subject to conditions defined by script");
121 Output.WriteLine(
"end note");
Root node of a simulation model
Variables GetEventVariables(IActor Actor)
Gets a collection of variables for a new event.
bool TryGetDistribution(string Id, out IDistribution Distribution)
Tries to get a registered distribution from the model.
Abstract base class for distributions
Abstract base class for events
async Task Trigger(Variables Variables, Expression Guard=null, int GuardLimit=int.MaxValue)
Triggers the event.
override Task Initialize()
Initialized the node before simulation.
void CheckTrigger(double t1, double t2, int NrCycles)
Check if event is triggered during a time period.
override Task FromXml(XmlElement Definition)
Sets properties and attributes of class in accordance with XML definition.
StochasticEvent(ISimulationNode Parent, Model Model)
Stochastic Event
override string UseCaseLinkName
Name of use case association.
override ISimulationNode Create(ISimulationNode Parent, Model Model)
Creates a new instance of the node.
override void ExportUseCaseData(StreamWriter Output, int Index)
Exports use case diagram data.
override string LocalName
Local name of XML element defining contents of class.
string DistributionId
ID of Distribution
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Class managing a script expression.
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
ISimulationNode Parent
Parent node in the simulation model.
Interface for distributions
int CheckTrigger(double t1, double t2, int NrCycles)
Check if distribution has a sample within the time period.
Interface for events that can be triggered by elapsed time.