Пример #1
0
        public Object GetObjectFromInitiator(Initiator init)
        {
            int    cell_id    = init.ID_of_MemoryCell;
            Object finded_obj = this.Memory.GetObjectByID(cell_id);

            return(finded_obj);
        }
Пример #2
0
 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;
 }
Пример #3
0
 public Executor(Model model)
 {
     this.ParentModel = model;
     this.TC_Cont     = new TimeAndConditionController(this);
     this.TIME        = 0;
     this.INITIATOR   = null;
     this.RAND        = new Random();
 }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        //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);
        }
Пример #8
0
        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);
        }
Пример #9
0
        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 = "Модель выполнилась до конца.";
            }
        }
Пример #10
0
 public void Add(Initiator init, DelayType delay)
 {
     this.Items.Add(new QueueItem(init, delay));
 }
Пример #11
0
 public QueueItem(Initiator init, DelayType delay)
 {
     this.Initiator = init;
     this.Delay     = delay;
 }
Пример #12
0
 public RecordCT(int id, Phrase cond, Initiator init, Subprogram subp)
     : base(id, init, subp)
 {
     this.Condition = cond;
 }
Пример #13
0
 public void SetInitiator(Initiator init)
 {
     this.INITIATOR = init;
 }
Пример #14
0
 public void Add(Initiator init)
 {
     init.Number = this.NumberCount;
     this.NumberCount++;
     this.Initiators.Add(init);
 }
Пример #15
0
 public RecordFTT(int id, double time, Initiator init, Subprogram subpr) :
     base(id, init, subpr)
 {
     this.ActiveTime = time;
 }
Пример #16
0
        public void Delete(int id)
        {
            Initiator init = this.Initiators.Find(i => i.ID_of_MemoryCell == id);

            this.Initiators.Remove(init);
        }
Пример #17
0
 public RecordEvent(int id, Initiator init, Subprogram subpr)
 {
     this.ID         = id;
     this.Initiator  = init;
     this.Subprogram = subpr;
 }