Beispiel #1
0
        public ViewModel_Rack(List <List <ViewModel_Vial> > vials, float weight, Model_Rack.RackPurpose position, uint capacity, uint rowCount, uint colCount)
        {
            Position = position;
            Vials    = vials;

            _Capacity = capacity;
            _RowCount = rowCount;
            _ColCount = colCount;
            _Weight   = weight;
        }
Beispiel #2
0
        public int GrabVialFromRack(int index, Model_Rack.RackPurpose rack)
        {
            int ElapsingTime = -1;

            if ((ArmPosition == Model_Arm.ArmPosition.INPUT_RACK || ArmPosition == Model_Arm.ArmPosition.OUTPUT_RACK) &&
                GripStatus == Model_Arm.GripStatus.HALT)
            {
                ElapsingTime = Model_Arm.TIME_TO_GRAB_VIAL_ms;
            }

            if (ElapsingTime >= 0)
            {
                BeginGripMovement(ElapsingTime, index, rack, Model_Arm.GripPosition.CLOSED, Model_Arm.GripStatus.CLOSING);
            }

            return(ElapsingTime);
        }
Beispiel #3
0
        public int ReleseVialToRack(int index, Model_Rack.RackPurpose rack)
        {
            int ElapsingTime = -1;

            if ((ArmPosition == Model_Arm.ArmPosition.INPUT_RACK || ArmPosition == Model_Arm.ArmPosition.OUTPUT_RACK) &&
                GripStatus == Model_Arm.GripStatus.HALT &&
                GripPosition == Model_Arm.GripPosition.CLOSED)
            {
                ElapsingTime = Model_Arm.TIME_TO_RELEASE_VIAL_ms;
            }

            if (ElapsingTime >= 0)
            {
                BeginGripMovement(ElapsingTime, index, rack, Model_Arm.GripPosition.OPEN, Model_Arm.GripStatus.OPENING);
            }

            return(ElapsingTime);
        }
Beispiel #4
0
        private void BeginGripMovement(int timeForGripAction, int index, Model_Rack.RackPurpose rack, Model_Arm.GripPosition newPosn, Model_Arm.GripStatus newStatus)
        {
            // Should only get here with a positive time and the _ArmTimer not running
            // Double check the arm and grip are not already moving
            if ((timeForGripAction >= 0) &&
                (Model_Arm.ArmStatus.HALT == ArmStatus) &&
                (Model_Arm.GripStatus.HALT == GripStatus) &&
                (false == _GripTimer.Enabled))
            {
                // Set the grip status and next state
                GripPosition       = Model_Arm.GripPosition.UNKNOWN;
                GripStatus         = newStatus;
                FutureGripPosition = newPosn;
                VialIndex          = index;
                Rack = rack;

                // Do not overwrite arm position
                FutureArmPosition = ArmPosition;

                _GripTimer.Interval = timeForGripAction;
                _GripTimer.Enabled  = true;
                _GripTimer.Start();
            }
        }
Beispiel #5
0
        /// <summary>
        /// Received then the grip has completed a movement
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="proceed"></param>
        /// <param name="message"></param>
        private void Arm_OnGripUpdateEventReceived(ViewModel_Arm sender, bool proceed, int index, Model_Arm.GripPosition grip, Model_Rack.RackPurpose rack, string message)
        {
            if (proceed)
            {
                if (SimulationState.STAGE1_PICK_UP_INPUT_VIAL == _CurrentState)
                {
                    // Belt and braces
                    if (Model_Rack.RackPurpose.INPUT == rack)
                    {
                        // Just picked up from input so set current input ID
                        _InputRack.SetCurrentID(index);
                        _RefreshInput = false;
                    }
                }

                if (SimulationState.STAGE6_PICK_UP_OUTPUT_VIAL == _CurrentState)
                {
                    // Belt and braces
                    if (Model_Rack.RackPurpose.OUTPUT == rack)
                    {
                        // Just picked up from output so set current output ID
                        _OutputRack.SetCurrentID(index);
                    }
                }

                if (SimulationState.STAGE10_PLACE_VIAL_AT_OUTPUT == _CurrentState)
                {
                    // Belt and braces
                    if (Model_Rack.RackPurpose.OUTPUT == rack)
                    {
                        _OutputRack.SetCurrentID(index + 1);
                    }
                }

                DoProceed();
            }
            RaiseEventOnTopLevel(OnSimulationUpdateEvent, new object[] { this, message });
        }