Exemple #1
0
        protected virtual void TriggerGet(Event @event = null)
        {
            var current = GetQueue.First;

            while (current != null)
            {
                var get = current.Value;
                DoGet(get);
                if (get.IsTriggered)
                {
                    var next = current.Next;
                    GetQueue.Remove(current);
                    current = next;
                    TriggerWhenEmpty();
                    TriggerWhenChange();
                }
                else
                {
                    current = current.Next;
                }
                if (Items.Count == 0)
                {
                    break;
                }
            }
            Utilization?.UpdateTo(Count / (double)Capacity);
            WIP?.UpdateTo(Count + PutQueue.Count + GetQueue.Count);
            GetQueueLength?.UpdateTo(GetQueue.Count);
        }
Exemple #2
0
 protected virtual void TriggerRelease(Event @event = null)
 {
     while (ReleaseQueue.Count > 0)
     {
         var release = ReleaseQueue.Peek();
         if (release.Request.IsAlive)
         {
             if (!RequestQueue.Remove(release.Request))
             {
                 throw new InvalidOperationException("Failed to cancel a request.");
             }
             BreakOffTime?.Add(Environment.ToDouble(Environment.Now - release.Request.Time));
             release.Succeed();
             ReleaseQueue.Dequeue();
         }
         else
         {
             DoRelease(release);
             if (release.IsTriggered)
             {
                 ReleaseQueue.Dequeue();
                 TriggerWhenAny();
                 TriggerWhenFull();
                 TriggerWhenChange();
             }
             else
             {
                 break;
             }
         }
     }
     Utilization?.UpdateTo(InUse / (double)Capacity);
     WIP?.UpdateTo(InUse + RequestQueue.Count);
     QueueLength?.UpdateTo(RequestQueue.Count);
 }
Exemple #3
0
        protected virtual void TriggerRequest(Event @event = null)
        {
            var current = RequestQueue.First;

            while (current != null)
            {
                var request = current.Value;
                DoRequest(request);
                if (request.IsTriggered)
                {
                    var next = current.Next;
                    RequestQueue.Remove(current);
                    current = next;
                    TriggerWhenEmpty();
                    TriggerWhenChange();
                }
                else
                {
                    current = current.Next;
                }
                if (Resources.Count == 0)
                {
                    break;
                }
            }
            Utilization?.UpdateTo(InUse / (double)Capacity);
            WIP?.UpdateTo(InUse + RequestQueue.Count);
            QueueLength?.UpdateTo(RequestQueue.Count);
        }
Exemple #4
0
 protected virtual void TriggerGet(Event @event = null)
 {
     while (GetQueue.Count > 0)
     {
         var get = GetQueue.Peek();
         DoGet(get);
         if (get.IsTriggered)
         {
             GetQueue.Dequeue();
             TriggerWhenEmpty();
             TriggerWhenChange();
         }
         else
         {
             break;
         }
     }
     Utilization?.UpdateTo(Count / (double)Capacity);
     WIP?.UpdateTo(Count + PutQueue.Count + GetQueue.Count);
     GetQueueLength?.UpdateTo(GetQueue.Count);
 }
Exemple #5
0
 protected virtual void TriggerRequest(Event @event = null)
 {
     while (RequestQueue.Count > 0)
     {
         var request = RequestQueue.First.Value;
         DoRequest(request);
         if (request.IsTriggered)
         {
             RequestQueue.RemoveFirst();
             TriggerWhenEmpty();
             TriggerWhenChange();
         }
         else
         {
             break;
         }
     }
     Utilization?.UpdateTo(InUse / (double)Capacity);
     WIP?.UpdateTo(InUse + RequestQueue.Count);
     QueueLength?.UpdateTo(RequestQueue.Count);
 }
 protected virtual void TriggerPickup(Event @event = null)
 {
     while (PickupQueue.Count > 0)
     {
         var get = PickupQueue.First.Value;
         DoPickup(get);
         if (get.IsTriggered)
         {
             PickupQueue.RemoveFirst();
             TriggerWhenEmpty();
             TriggerWhenChange();
         }
         else
         {
             break;
         }
     }
     Utilization?.UpdateTo(Location.Height / (double)Location.MaxHeight);
     WIP?.UpdateTo(Location.Height + DropoffQueue.Count + PickupQueue.Count);
     PickupQueueLength?.UpdateTo(PickupQueue.Count);
 }
Exemple #7
0
 protected virtual void TriggerPut(Event @event = null)
 {
     while (PutQueue.Count > 0)
     {
         var put = PutQueue.Peek();
         DoPut(put);
         if (put.IsTriggered)
         {
             PutQueue.Dequeue();
             TriggerWhenNew();
             TriggerWhenAny();
             TriggerWhenFull();
             TriggerWhenChange();
         }
         else
         {
             break;
         }
     }
     Utilization?.UpdateTo(Count / (double)Capacity);
     WIP?.UpdateTo(Count + PutQueue.Count + GetQueue.Count);
     PutQueueLength?.UpdateTo(PutQueue.Count);
 }
 protected virtual void TriggerDropoff(Event @event = null)
 {
     while (DropoffQueue.Count > 0)
     {
         var put = DropoffQueue.First.Value;
         DoDropoff(put);
         if (put.IsTriggered)
         {
             DropoffQueue.RemoveFirst();
             TriggerWhenNew();
             TriggerWhenAny();
             TriggerWhenFull();
             TriggerWhenChange();
         }
         else
         {
             break;
         }
     }
     Utilization?.UpdateTo(Location.Height / (double)Location.MaxHeight);
     WIP?.UpdateTo(Location.Height + DropoffQueue.Count + PickupQueue.Count);
     DropoffQueueLength?.UpdateTo(DropoffQueue.Count);
 }