コード例 #1
0
        /// <summary>
        /// Check validity of output rack count, inform user if not correct
        /// </summary>
        /// <returns></returns>
        private bool SetOutputRackCapacity()
        {
            bool success = false;

            try
            {
                int value = Int32.Parse(TextBox_OutputRackCapacity.Text.ToString());
                if (Model_SimulationParameters.ParseOutputRackCapacity(value))
                {
                    _VM.SimulationParameters.OutputRackCapacity = (uint)value;
                    success = true;
                    UpdateDebugOutput(string.Format("\n Output Rack Capacity set to {0}", _VM.SimulationParameters.OutputRackCapacity));
                }
                else
                {
                    UpdateDebugOutput(string.Format("\nERROR! Output Rack Capacity must be between {0} and {1}",
                                                    Model_SimulationParameters.MIN_OUTPUT_RACK_CAPACITY,
                                                    Model_SimulationParameters.MAX_OUTPUT_RACK_CAPACITY));
                }
            }
            catch (FormatException)
            {
                UpdateDebugOutput("\nERROR! Output Rack Capacity must be an integer!");
            }
            return(success);
        }
コード例 #2
0
        /// <summary>
        /// Check validity of flow rate, inform user if not correct
        /// </summary>
        /// <returns></returns>
        private bool SetDispenserFlowRate()
        {
            bool success = false;

            try
            {
                int value = Int32.Parse(TextBox_DispenserFlowRate.Text.ToString());
                if (Model_SimulationParameters.ParseFlowRate(value))
                {
                    _VM.SimulationParameters.DispenserFlowRate_mgs = value;
                    success = true;
                    UpdateDebugOutput(string.Format("\n Balance Error set to {0} mg", _VM.SimulationParameters.DispenserFlowRate_mgs));
                }
                else
                {
                    UpdateDebugOutput(string.Format("\nERROR! Flow Rate must be between {0} and {1} mg/s",
                                                    Model_SimulationParameters.MIN_FLOW_RATE_mgs,
                                                    Model_SimulationParameters.MAX_FLOW_RATE_mgs));
                }
            }
            catch (FormatException)
            {
                UpdateDebugOutput("\nERROR! Balance Error must be a real number!");
            }
            return(success);
        }
コード例 #3
0
        private bool SetBalanceError()
        {
            bool success = false;

            try
            {
                float value = float.Parse(TextBox_BalanceError.Text.ToString());
                if (Model_SimulationParameters.ParseBalanceError(value))
                {
                    _VM.SimulationParameters.BalanceError_mg = value;
                    success = true;
                    UpdateDebugOutput(string.Format("\n Balance Error set to {0} mg", _VM.SimulationParameters.BalanceError_mg));
                }
                else
                {
                    UpdateDebugOutput(string.Format("\nERROR! Balance Error must be greater than {0} mg",
                                                    Model_SimulationParameters.MIN_BALANCE_ERROR_mg));
                }
            }
            catch (FormatException)
            {
                UpdateDebugOutput("\nERROR! Balance Error must be a real number!");
            }
            return(success);
        }
コード例 #4
0
        /// <summary>
        /// Check validity of target weight, inform user if not correct
        /// </summary>
        /// <returns></returns>
        private bool SetTargetOutputWeight()
        {
            bool success = false;

            try
            {
                int   result = 0;
                float value  = float.Parse(TextBox_OutputWeight.Text.ToString());
                result = Model_SimulationParameters.ParseTargetOutputWeight(value, _VM.SimulationParameters.BalanceError_mg);
                if (0 == result)
                {
                    _VM.SimulationParameters.TargetOutputVialWeight_mg = value;
                    success = true;
                    UpdateDebugOutput(string.Format("\n Target Output Weight set to {0} mg", _VM.SimulationParameters.TargetOutputVialWeight_mg));
                }
                else if (1 == result)
                {
                    UpdateDebugOutput(string.Format("\nERROR! Target Output Weight must be between {0} and {1} mg",
                                                    Model_SimulationParameters.MIN_TARGET_OUTPUT_WEIGHT_mg,
                                                    _VM.SimulationParameters.BalanceError_mg));
                }
                else if (-1 == result)
                {
                    UpdateDebugOutput(string.Format("\nERROR! Target Output Weight must be greater than the specified balance error of {0} mg",
                                                    _VM.SimulationParameters.BalanceError_mg));
                }
                else
                {
                    UpdateDebugOutput("\nERROR! Target Output Weight unknown error!");
                }
            }
            catch (FormatException)
            {
                UpdateDebugOutput("\nERROR! Target Output Weight must be a real number!");
            }
            return(success);
        }
コード例 #5
0
        /// <summary>
        /// Check validity of division factor, inform user if not correct
        /// </summary>
        /// <returns></returns>
        private bool SetOutputDivisionFactor()
        {
            bool success = false;

            try
            {
                int result = 0;
                int value  = Int32.Parse(TextBox_OutputDivison.Text.ToString());
                result = Model_SimulationParameters.ParseOutputDivisionFactor(value, (int)_VM.SimulationParameters.InputRackCapacity, (int)_VM.SimulationParameters.OutputRackCapacity);
                if (0 == result)
                {
                    _VM.SimulationParameters.OutputDivisionFactor = (uint)value;
                    success = true;
                    UpdateDebugOutput(string.Format("\n Output Division Factor set to {0}", _VM.SimulationParameters.OutputDivisionFactor));
                }
                else if (1 == result)
                {
                    UpdateDebugOutput(string.Format("\nERROR! Output Division Factor must be an integer between {0} and {1}",
                                                    Model_SimulationParameters.MIN_OUTPUT_DIV_FACTOR,
                                                    Model_SimulationParameters.GetMaxOutputDivFactor((int)_VM.SimulationParameters.InputRackCapacity, (int)_VM.SimulationParameters.OutputRackCapacity)));
                }
                else if (-1 == result)
                {
                    UpdateDebugOutput(string.Format("\nERROR! Output Rack Capacity is less than Input Capacity.\nDivision Factor must be 1!"));
                }
                else
                {
                    UpdateDebugOutput("\nERROR! Output Division Factor unknown error!");
                }
            }
            catch (FormatException)
            {
                UpdateDebugOutput("\nERROR! Output Division Factor must be an integer!");
            }
            return(success);
        }