public Object GetObjectFromInitiator(Initiator init) { int cell_id = init.ID_of_MemoryCell; Object finded_obj = this.Memory.GetObjectByID(cell_id); return(finded_obj); }
public void SetCurrentUnit(Unit unit) { this.INITIATOR = new Initiator(InitiatorType.Description); this.INITIATOR.NextOperator = new Operator(); this.INITIATOR.NextOperator.ParentSubprogram = new Subprogram(); this.INITIATOR.NextOperator.ParentSubprogram.Unit = unit; }
public Executor(Model model) { this.ParentModel = model; this.TC_Cont = new TimeAndConditionController(this); this.TIME = 0; this.INITIATOR = null; this.RAND = new Random(); }
public void InsertConditionRecord(Phrase phrase, Initiator init, Subprogram subp /*int lable*/, bool islast) { if (islast) { ID_event_Counter--; } RecordCT NewRec = new RecordCT(ID_event_Counter, phrase, init, subp); ID_event_Counter++; CT.Insert(NewRec); }
public void AddTimeRecord(double time, Initiator init, Subprogram subp /*int lable*/, bool islast) { if (islast) { ID_event_Counter--; } RecordFTT NewRec = new RecordFTT(ID_event_Counter, time, init, subp); ID_event_Counter++; FTT.Add(NewRec); }
public Initiator ActivateFromLink(string link_name, string link_unit) { Initiator init = new Initiator(InitiatorType.Flow); Object obj = GetObjectFromLink(link_name, link_unit); //obj = this.ParentModel.Memory.AddSingletonObject(obj); init.ID_of_MemoryCell = obj.ID; this.IT.Add(init); return(init); }
//public Scalar GetScalar(string name, string unit) //{ // return (Scalar)this.GVT.Vars[unit].Find(o => o.Name == name); //} //public Link GetLink(string name, string unit) //{ // return (Link)this.GVT.Vars[unit].Find(o => o.Name == name); //} ///!!! //public Object GetVectorNode(string vector_name, Phrase path, string unit) //{ // Object result; // //string vector_name = ((Word)(path.Value[0])).LValue; // Phrase inner_node = path.Value[1]; // Vector parent_vector = (Vector)this.GVT.Vars[unit].Find(v => v.Name == vector_name); // //SLT.Scalar updated_scalar = (Scalar)this.ParentModel.GVT.Vars[unit].Find(o => o.Name == name); // result = parent_vector.FindNode(inner_node);//Scalar or Link // return result; // //updated_obj.SetValue(value); //} //INITIAORS public Initiator CreateInitiator(string unit_name) { Initiator init = new Initiator(InitiatorType.Aggregate); //Subprogram subp = this.ParentModel.ST_Cont.Tracks.Find(sp => sp.Unit.Name == unit_name); //init.Position = subp; Object obj = new Scalar("Инициатор блока", unit_name, unit_name); obj = this.Memory.AddSingletonObject(obj); init.ID_of_MemoryCell = obj.ID; this.IT.Add(init); return(init); }
int GetArrowType(Queue queue, int index) { int arrow = (int)Queue.ArrowType.None; int position = queue.Place.Operators[0].Start; if (queue.Items.Count < index + 1) { return((int)Queue.ArrowType.None); } Initiator init = queue.Items[index].Initiator; bool finded = false; List <Queue> qt = this.Model.Executor.QT.Queues; foreach (Queue inner_q in qt) { if (inner_q.Items.Exists(i => (i.Initiator == init) && (inner_q != queue))) { finded = true; break; } } arrow += (int)Queue.ArrowType.Full; if (finded) { arrow = (int)Queue.ArrowType.Half; } switch (queue.Items[index].Delay) { case Queue.DelayType.Ready: arrow += (int)Queue.ArrowType.Ready; break; case Queue.DelayType.WaitTime: arrow += (int)Queue.ArrowType.WaitTime; break; case Queue.DelayType.Stopped: arrow += (int)Queue.ArrowType.Stopped; break; } return(arrow); }
void SetState() { RecordEvent next_event = this.TC_Cont.FindNextEvent(); if (next_event != null) { this.TC_Cont.DeleteRecords(next_event.ID); this.INITIATOR = next_event.Initiator; this.INITIATOR.NextOperator = next_event.Subprogram.Operators[0]; if (next_event.GetType() == typeof(RecordFTT)) { double active_time = ((RecordFTT)next_event).ActiveTime; this.TIME = active_time; } } else { this.ParentModel.StatusInfo = "Модель выполнилась до конца."; } }
public void Add(Initiator init, DelayType delay) { this.Items.Add(new QueueItem(init, delay)); }
public QueueItem(Initiator init, DelayType delay) { this.Initiator = init; this.Delay = delay; }
public RecordCT(int id, Phrase cond, Initiator init, Subprogram subp) : base(id, init, subp) { this.Condition = cond; }
public void SetInitiator(Initiator init) { this.INITIATOR = init; }
public void Add(Initiator init) { init.Number = this.NumberCount; this.NumberCount++; this.Initiators.Add(init); }
public RecordFTT(int id, double time, Initiator init, Subprogram subpr) : base(id, init, subpr) { this.ActiveTime = time; }
public void Delete(int id) { Initiator init = this.Initiators.Find(i => i.ID_of_MemoryCell == id); this.Initiators.Remove(init); }
public RecordEvent(int id, Initiator init, Subprogram subpr) { this.ID = id; this.Initiator = init; this.Subprogram = subpr; }