Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="protocolId"></param>
        /// <param name="sampleVolume_ul"></param>
        /// <param name="result"></param>
        public void CalculateConsumables(int protocolId, double sampleVolume_ul,
                                         out Hashtable[] result)
        {
            result = null;

            try
            {
                if (IsConnectionEnabled)
                {
                    // Get the consumables based on chosen protocol and sample volume (if any)
                    XmlRpcConsumables[] consumables = null;
                    consumables = myXmlRpcProxy.CalculateConsumables(protocolId, sampleVolume_ul);

                    // Allocate an array of hashtables with which to return the consumables
                    int consumablesQuadrantCount = consumables.GetLength(0);
                    result = new Hashtable[consumablesQuadrantCount];
                    for (int i = 0; i < consumablesQuadrantCount; ++i)
                    {
                        result[i] = new Hashtable();
                    }

                    // Assign consumable values on a per-quadrant basis.
                    for (int relativeQuadrant = 0; relativeQuadrant < consumables.GetLength(0);
                         ++relativeQuadrant)
                    {
                        // Assign consumable values to the relevant quadrant locations.
                        // Note this does include the SampleTube since in theory it may be used as a vessel
                        // in protocols that use more than one quadrant.
                        // NOTE: we use a key of "<relativeQuadrantId>.<quadrantLocation>" in the
                        // returned hashtable so we can handle consumables requirements of
                        // >= 1 quadrant's worth of resources.
                        //
                        // NOTE: we use the following convention to convert boolean 'required' flags to
                        // equivalent fluid volumes for the cases that do not specify a volume:
                        // -ve value:	this resource is not required and should not be loaded (e.g. no tube)
                        // 0.0 value:	this resource is required (e.g. load tips box or load an empty tube)
                        // +ve value:	this resource is required with the specified volume (e.g. load a tube with 1ml of relevant reagent)
                        if (consumables[relativeQuadrant].sampleVesselRequired)
                        {
                            // RL - uniform multi sample - 03/23/06
                            if (consumables[relativeQuadrant].sampleVesselVolumeRequired && relativeQuadrant != 0)
                            {
                                result[relativeQuadrant].Add(
                                    RelativeQuadrantLocation.SampleTube,
                                    new FluidVolume(
                                        sampleVolume_ul,
                                        FluidVolumeUnit.MicroLitres));
                            }
                            else
                            {
                                result[relativeQuadrant].Add(
                                    RelativeQuadrantLocation.SampleTube,
                                    new FluidVolume(
                                        0.0d,
                                        FluidVolumeUnit.MicroLitres));
                            }
                        }

                        if (consumables[relativeQuadrant].separationVesselRequired)
                        {
                            result[relativeQuadrant].Add(
                                RelativeQuadrantLocation.SeparationTube,
                                new FluidVolume(
                                    0.0d,
                                    FluidVolumeUnit.MicroLitres));
                        }

                        if (consumables[relativeQuadrant].wasteVesselRequired)
                        {
                            result[relativeQuadrant].Add(
                                RelativeQuadrantLocation.WasteTube,
                                new FluidVolume(
                                    0.0d,
                                    FluidVolumeUnit.MicroLitres));
                        }

                        if (consumables[relativeQuadrant].tipBoxRequired)
                        {
                            result[relativeQuadrant].Add(
                                RelativeQuadrantLocation.TipsBox,
                                new FluidVolume(
                                    0.0d,
                                    FluidVolumeUnit.MicroLitres));
                        }

                        if (consumables[relativeQuadrant].particleVolume >= 0.0d)
                        {
                            result[relativeQuadrant].Add(
                                RelativeQuadrantLocation.VialA,
                                new FluidVolume(
                                    consumables[relativeQuadrant].particleVolume,
                                    FluidVolumeUnit.MicroLitres));
                        }

                        if (consumables[relativeQuadrant].cocktailVolume >= 0.0d)
                        {
                            result[relativeQuadrant].Add(
                                RelativeQuadrantLocation.VialB,
                                new FluidVolume(
                                    consumables[relativeQuadrant].cocktailVolume,
                                    FluidVolumeUnit.MicroLitres));
                        }

                        if (consumables[relativeQuadrant].antibodyVolume >= 0.0d)
                        {
                            result[relativeQuadrant].Add(
                                RelativeQuadrantLocation.VialC,
                                new FluidVolume(
                                    consumables[relativeQuadrant].antibodyVolume,
                                    FluidVolumeUnit.MicroLitres));
                        }

                        if (consumables[relativeQuadrant].lysisVolume >= 0.0d)
                        {
                            result[relativeQuadrant].Add(
                                RelativeQuadrantLocation.LysisBufferTube,
                                new FluidVolume(
                                    consumables[relativeQuadrant].lysisVolume,
                                    FluidVolumeUnit.MicroLitres));
                        }

                        if (consumables[relativeQuadrant].bulkBufferVolume >= 0.0d)
                        {
                            result[relativeQuadrant].Add(
                                RelativeQuadrantLocation.QuadrantBuffer,
                                new FluidVolume(
                                    consumables[relativeQuadrant].bulkBufferVolume,
                                    FluidVolumeUnit.MicroLitres));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // Log the details of the exception
                LogException(ex, "CalculateConsumables");
            }
        }