コード例 #1
0
        public Driver(string xmlText)
        {
            m_Devices = new List <Device>();

            if (string.IsNullOrEmpty(xmlText))
            {
                xmlText = DefaultXmlText();
            }

            m_Doc = XDocument.Parse(xmlText);
            XElement configElement = m_Doc.Element(Element.Configuration);

            if (configElement == null)
            {
                throw new ArgumentException("Cannot find the root element \"" + Element.Configuration + "\"");
            }

            XElement driverElement = configElement.Element(Element.Driver);

            if (driverElement == null)
            {
                driverElement = new XElement(Element.Driver);
                driverElement.Add(new XAttribute(Attribute.Id, Id));
                configElement.Add(driverElement);
            }

            m_Root = driverElement.Element(Element.Common);
            if (m_Root == null)
            {
                m_Root = new XElement(Element.Common);
                driverElement.Add(m_Root);
            }

            m_Description = Xml.GetElementValueText(m_Root, Element.Description, "This is an example driver", true);

            m_Demo = new Demo(driverElement, DeviceId.Demo);
            m_Devices.Add(m_Demo);

            m_Heater = new Heater(driverElement, DeviceId.Heater);
            m_Devices.Add(m_Heater);

            m_Pump = new Pump(driverElement, DeviceId.Pump);
            m_Devices.Add(m_Pump);

            m_AutoSampler = new AutoSampler(driverElement, DeviceId.AutoSampler);
            m_Devices.Add(m_AutoSampler);

            m_Detector = new Detector(driverElement, DeviceId.Detector);
            m_Devices.Add(m_Detector);

            m_Devices.Sort((Device device1, Device device2) => device1.Id.CompareTo(device2.Id));
        }
コード例 #2
0
 public AutoSampler(IDriverEx driver, IDDK ddk, Config.AutoSampler config, string id)
     : base(driver, ddk, typeof(AutoSampler).Name, id, config.Name)
 {
 }
コード例 #3
0
        public AutoSampler(IDriverEx driver, IDDK ddk, Config.AutoSampler config, string id)
            : base(driver, ddk, typeof(AutoSampler).Name, id, config.Name)
        {
            Log.TaskBegin(Id);
            try
            {
                m_Properties = new AutoSamplerProperties(m_DDK, m_Device);

                ITypeDouble volumeType = m_DDK.CreateDouble(0.1, 30, 3);
                volumeType.Unit = UnitConversionEx.PhysUnitName(UnitConversion.PhysUnitEnum.PhysUnit_MicroLiter); // µl

                int      positionMax  = m_RackInfos.Sum(item => item.TubeColumnsCount * item.TubeRowsCount);
                ITypeInt positionType = m_DDK.CreateInt(1, positionMax);
                positionType.NamedValuesOnly = false;
                int position = positionType.Minimum.GetValueOrDefault() - 1;
                foreach (RackInfo rack in m_RackInfos)
                {
                    int tubeNumber = rack.TubeFirstNumber - 1;

                    for (int row = 1; row <= rack.TubeRowsCount; row++)
                    {
                        for (int col = 1; col <= rack.TubeColumnsCount; col++)
                        {
                            position++;
                            tubeNumber++;
                            string positionName = rack.TubePositionNamePrefix + tubeNumber.ToString();
                            positionType.AddNamedValue(positionName, tubeNumber);
                        }
                    }
                }

                m_InjectHandler = m_Device.CreateInjectHandler(volumeType, positionType);

                m_RackDesciptionProperty            = m_Device.CreateStandardProperty(StandardPropertyID.TrayDescription, m_DDK.CreateString(1000));
                m_RackDesciptionProperty.AuditLevel = AuditLevel.Service;
                string rackDescription = GetRackDescription();
                if (m_RackDesciptionProperty.DataType.Length < rackDescription.Length)
                {
                    throw new InvalidOperationException("m_RackDesciptionProperty length " + m_RackDesciptionProperty.DataType.Length + " is less than the needed " + rackDescription.Length.ToString());
                }
                m_RackDesciptionProperty.Update(rackDescription);

                m_Position       = -1;
                m_VolumeUnitName = m_InjectHandler.VolumeProperty.DataType.Unit;  // µl
                m_VolumeUnit     = UnitConversionEx.PhysUnitFindName(m_VolumeUnitName);

                m_InjectHandler.PositionProperty.OnSetProperty += OnPropertyPositionSet;
                m_InjectHandler.VolumeProperty.OnSetProperty   += OnPropertyVolumeSet;

                m_InjectHandler.InjectCommand.OnCommand += OnCommandInjectHandlerInject;

                m_Device.OnBatchPreflightBegin += OnDeviceBatchPreflightBegin;

                m_Device.OnPreflightEnd += OnDevicePreflightEnd;

                m_Device.OnTransferPreflightToRun += OnDeviceTransferPreflightToRun;

                m_Device.OnSequenceStart  += OnDeviceSequenceStart;
                m_Device.OnSequenceChange += OnDeviceSequenceChange;
                m_Device.OnSequenceEnd    += OnDeviceSequenceEnd;

                m_Device.OnBroadcast += OnDeviceBroadcast;

                m_Driver.OnConnected    += OnDriverConnected;
                m_Driver.OnDisconnected += OnDriverDisconnected;

                Log.TaskEnd(Id);
            }
            catch (Exception ex)
            {
                Log.TaskEnd(Id, ex);
                throw;
            }
        }