public DeviceProperties(IDDK ddk, IDevice device, string deviceId, string deviceType, string deviceName)
        {
            if (ddk == null)
            {
                throw new ArgumentNullException("ddk");
            }
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }
            if (string.IsNullOrEmpty(deviceType))
            {
                throw new ArgumentNullException("deviceType");
            }
            if (string.IsNullOrEmpty(deviceName))
            {
                throw new ArgumentNullException("deviceName");
            }
            if (deviceName.Length != deviceName.Trim().Length)
            {
                throw new ArgumentException("Device Name is invalid - it starts or ends with space");
            }

            // ModelNo is used to identify the device in the instrument method editor plug-in
            Debug.Assert(StandardPropertyID.ModelNo.ToString() == Property.ConstantName.ModelNo);
            IStringProperty stringProperty = device.CreateStandardProperty(StandardPropertyID.ModelNo, ddk.CreateString(100));

            stringProperty.Update(deviceType);

            stringProperty = Property.CreateString(ddk, device, Property.ConstantName.InternalName);
            stringProperty.Update(deviceId);
            stringProperty.AuditLevel = AuditLevel.Expert;

            stringProperty = Property.CreateString(ddk, device, Property.ConstantName.DeviceType);
            stringProperty.Update(deviceType);

            stringProperty = Property.CreateString(ddk, device, "DeviceName");
            stringProperty.Update(deviceName);

            Description = Property.CreateString(ddk, device, "DeviceDescription");
            Description.Update("Description for " + deviceId);
            // Description.Writeable = true; - not needed, because of m_Properties.DeviceDesription.OnSetProperty += OnPropertyDeviceDesriptionSet;

            Language = Property.CreateString(ddk, device, "DeviceLanguage");
            Language.Update("Language for " + deviceId);
        }
예제 #2
0
        /// OnDebugCommand will be called when the DebugCommand property is set by CM.
        private void OnDebugCommand(SetPropertyEventArgs args)
        {
            Debug.Assert(args.Property == m_DebugCommand);
            SetStringPropertyEventArgs stringPropertyArgs = args as SetStringPropertyEventArgs;

            Driver.Comm.SendLine(stringPropertyArgs.NewValue);
            m_DebugCommand.Update(stringPropertyArgs.NewValue);
        }
예제 #3
0
        /// <summary>
        /// Create our Dionex.Chromeleon.Symbols.IDevice and our Properties and Commands
        /// </summary>
        /// <param name="cmDDK">The DDK instance</param>
        /// <param name="name">The name for our device</param>
        /// <returns>our IDevice object</returns>
        internal IDevice Create(IDDK cmDDK, string name)
        {
            m_MyCmDDK = cmDDK;

            // Create our Dionex.Chromeleon.Symbols.IDevice
            m_MyCmDevice = cmDDK.CreateDevice(name, "Autosampler device.");

            ITypeDouble tVolume = cmDDK.CreateDouble(0.1, 10.0, 1);

            tVolume.Unit = "µL";

            ITypeInt tPosition = cmDDK.CreateInt(1, 10);

            for (int i = 1; i <= 10; i++)
            {
                tPosition.AddNamedValue("RA" + i.ToString(), i);
            }
            tPosition.NamedValuesOnly = false;

            m_InjectHandler = m_MyCmDevice.CreateInjectHandler(tVolume, tPosition);

            m_InjectHandler.PositionProperty.OnSetProperty +=
                new SetPropertyEventHandler(OnSetPosition);

            m_InjectHandler.VolumeProperty.OnSetProperty +=
                new SetPropertyEventHandler(OnSetVolume);

            m_InjectHandler.InjectCommand.OnCommand += new CommandEventHandler(OnInject);

            ICommand simulateVialNotFoundCommand =
                m_MyCmDevice.CreateCommand("SimulateVialNotFound", "Simulate a vial not found error");

            simulateVialNotFoundCommand.OnCommand += new CommandEventHandler(simulateVialNotFoundCommand_OnCommand);

            ICommand modifyPositionTypeCommand =
                m_MyCmDevice.CreateCommand("ModifyPositionType", "Changes the data type of the Position property and the Inject.Position parameter");

            modifyPositionTypeCommand.OnCommand += new CommandEventHandler(modifyPositionTypeCommand_OnCommand);

            ICommand modifyVolumeTypeCommand =
                m_MyCmDevice.CreateCommand("ModifyVolumeType", "Changes the data type of the Volume property and the Inject.Volume parameter");

            modifyVolumeTypeCommand.OnCommand += new CommandEventHandler(modifyVolumeTypeCommand_OnCommand);

            ITypeString tTrayDescription = cmDDK.CreateString(500); // ensure length is sufficient, but don't be too generous

            m_TrayDesciptionProperty            = m_MyCmDevice.CreateStandardProperty(StandardPropertyID.TrayDescription, tTrayDescription);
            m_TrayDesciptionProperty.AuditLevel = AuditLevel.Service;
            m_TrayDesciptionProperty.Update(GenerateTrayDescription());

            // In this example driver, simulating the injection process
            // is handled by a timer started by the Inject command.
            // When the timer has elapsed the inject response is generated.
            m_InjectionTimer.Elapsed  += new System.Timers.ElapsedEventHandler(m_InjectionTimer_Elapsed);
            m_InjectionTimer.AutoReset = false;

            return(m_MyCmDevice);
        }
예제 #4
0
        internal void Create(IDDK cmDDK, string deviceName)
        {
            m_DDK    = cmDDK;
            m_Device = m_DDK.CreateDevice(deviceName, "Pump device");

            IStringProperty typeProperty =
                m_Device.CreateProperty("DeviceType",
                                        "The DeviceType property tells us which component we are talking to.",
                                        m_DDK.CreateString(20));

            typeProperty.Update("Pump");


            // A data type for our pump flow
            ITypeDouble tFlow = m_DDK.CreateDouble(0, 10, 1);

            tFlow.Unit = "ml/min";

            // Create our flow handler. The flow handler creates a Flow.Nominal,
            // a Flow.Value and 4 eluent component properties for us.
            m_FlowHandler = m_Device.CreateFlowHandler(tFlow, 4, 2);

            m_FlowHandler.FlowNominalProperty.OnSetProperty += OnSetFlow;

            // initialize the flow
            m_FlowHandler.FlowNominalProperty.Update(0);

            // initialize the components
            m_FlowHandler.ComponentProperties[0].Update(100.0);
            m_FlowHandler.ComponentProperties[1].Update(0);
            m_FlowHandler.ComponentProperties[2].Update(0);
            m_FlowHandler.ComponentProperties[3].Update(0);


            // A type for our pump pressure
            ITypeDouble tPressure = m_DDK.CreateDouble(0, 400, 1);

            tPressure.Unit = "bar";

            // We create a struct for the pressure with Value, LowerLimit and UpperLimit
            m_PressureStruct = m_Device.CreateStruct("Pressure", "The pump pressure.");

            m_PressureValue = m_PressureStruct.CreateStandardProperty(StandardPropertyID.Value, tPressure);

            m_PressureLowerLimit = m_PressureStruct.CreateStandardProperty(StandardPropertyID.LowerLimit, tPressure);
            m_PressureLowerLimit.OnSetProperty += new SetPropertyEventHandler(OnSetPressureLowerLimit);
            m_PressureLowerLimit.Update(0.0);

            m_PressureUpperLimit = m_PressureStruct.CreateStandardProperty(StandardPropertyID.UpperLimit, tPressure);
            m_PressureUpperLimit.OnSetProperty += new SetPropertyEventHandler(OnSetPressureUpperLimit);
            m_PressureUpperLimit.Update(400.0);

            m_PressureStruct.DefaultGetProperty = m_PressureValue;

            m_Device.OnTransferPreflightToRun += new PreflightEventHandler(OnTransferPreflightToRun);
        }
예제 #5
0
        /// <summary>
        /// OnConnect we set up some initial values.
        /// In a real driver, OnConnect would establish the hardware connection first and
        /// retrieve the actual hardware status from the hardware.
        /// </summary>
        internal void OnConnect()
        {
            // Write a message to the audit trail
            m_MyCmDevice.AuditMessage(AuditLevel.Message, "ExampleDevice.OnConnect()");

            // set up the initial values
            m_EnableClockProperty.Update(0);

            m_MyString = "Initial value";
            // Send the updated string to Chromeleon.
            m_AnyTextProperty.Update(m_MyString);

            m_Percentage = 11.11;
            // Send the updated percentage to Chromeleon.
            m_PercentageProperty.Update(m_Percentage);

            // Update the other properties
            m_FilterTimeConstantProperty.Update(0.0);
            m_MeasurementRangeProperty.Update(10.0);
        }
예제 #6
0
        void m_MyStringProperty_OnSetProperty(SetPropertyEventArgs args)
        {
            SetStringPropertyEventArgs stringArgs = args as SetStringPropertyEventArgs;
            String newValue = stringArgs.NewValue;
            String message  = String.Format("New value #{0}#", stringArgs.NewValue);

            m_MyCmDevice.AuditMessage(AuditLevel.Normal, message);
            m_MyStringProperty.Update(stringArgs.NewValue);
            m_MyStringProperty.LogValue();
            message = String.Format("Internal value #{0}#", m_MyStringProperty.Value);
            m_MyCmDevice.AuditMessage(AuditLevel.Normal, message);
        }
예제 #7
0
        internal void Create(IDDK cmDDK, string deviceName)
        {
            m_DDK    = cmDDK;
            m_Device = m_DDK.CreateDevice(deviceName, "LCSystem device. This is our master device.");

            IStringProperty typeProperty =
                m_Device.CreateProperty("DeviceType",
                                        "The DeviceType property tells us which component we are talking to.",
                                        m_DDK.CreateString(20));

            typeProperty.Update("LCSystem");
        }
        public DemoProperties(IDriverEx driver, IDDK ddk, Config.Demo config, IDevice device)
        {
            if (ddk == null)
            {
                throw new ArgumentNullException("ddk");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            LogInFile            = Property.CreateBool(ddk, device, "LogInFile");
            LogInFile.Writeable  = true;
            LogInFile.AuditLevel = AuditLevel.Service;
            LogInFile.Update(Property.GetBoolNumber(true));  // Can be configurable = config.LogInFile

            m_IsSimulated = Property.CreateBool(ddk, device, "IsSimulated");
            m_IsSimulated.Update(Property.GetBoolNumber(driver.IsSimulated));
            if (driver.IsSimulated != config.IsSimulated)
            {
                Device.DebuggerBreak();
            }

            FirmwareUsbAddress = Property.CreateString(ddk, device, "FirmwareUsbAddress");
            FirmwareUsbAddress.Update(driver.FirmwareUsbAddress);

            FirmwareVersion = Property.CreateString(ddk, device, "FirmwareVersion");
            FirmwareVersion.Update(driver.FirmwareVersion);

            SerialNo = device.CreateStandardProperty(StandardPropertyID.SerialNo, ddk.CreateString(100));
            SerialNo.Update(driver.SerialNo);

            TaskName              = Property.CreateString(ddk, device, "TaskName", driver.TaskName);
            TaskNamePrevious      = Property.CreateString(ddk, device, "TaskNamePrevious", driver.TaskNamePrevious);
            TaskPreviousErrorText = Property.CreateString(ddk, device, "TaskPreviousErrorText", driver.TaskPreviousErrorText);

            CommunicationState = Property.CreateEnum(ddk, device, "CommunicationState", driver.CommunicationState, null);
            BehaviorStatePrev  = Property.CreateEnum(ddk, device, "BehaviorStatePrev", driver.BehaviorStatePrev);
            BehaviorState      = Property.CreateEnum(ddk, device, "BehaviorState", driver.BehaviorState);

            ProcessStep = Property.CreateInt(ddk, device, "ProcessStep");
            ProcessStep.Update(0);
        }
        /// <summary>
        /// Create our Dionex.Chromeleon.Symbols.IDevice and our Properties and Commands
        /// </summary>
        /// <param name="cmDDK">The DDK instance</param>
        /// <param name="name">The name for our device</param>
        /// <returns>our IDevice object</returns>
        internal IDevice Create(IDDK cmDDK, string name)
        {
            // Load the help text from the resource
            string deviceHelpText =
                Properties.Resources.LocalizedDevice_HelpText;

            // Create our Dionex.Chromeleon.Symbols.IDevice
            m_MyCmDevice = cmDDK.CreateDevice(name, deviceHelpText);

            // Load the help text from the resource
            string statusPropertyText =
                Properties.Resources.StatusProperty_HelpText;

            // create a test Property containing a string
            m_statusProperty =
                m_MyCmDevice.CreateProperty("Status", statusPropertyText, cmDDK.CreateString(20));
            m_statusProperty.Update("Disconnected.");

            return(m_MyCmDevice);
        }
예제 #10
0
        internal void Create(IDDK cmDDK, string deviceName)
        {
            m_DDK    = cmDDK;
            m_Device = m_DDK.CreateDevice(deviceName, "Sampler device");

            IStringProperty typeProperty =
                m_Device.CreateProperty("DeviceType",
                                        "The DeviceType property tells us which component we are talking to.",
                                        m_DDK.CreateString(20));

            typeProperty.Update("Sampler");


            ITypeDouble tVolume   = m_DDK.CreateDouble(0.1, 10.0, 1);
            ITypeInt    tPosition = m_DDK.CreateInt(1, 10);

            m_InjectHandler = m_Device.CreateInjectHandler(tVolume, tPosition);

            m_InjectHandler.PositionProperty.OnSetProperty +=
                new SetPropertyEventHandler(OnSetPosition);

            m_InjectHandler.VolumeProperty.OnSetProperty +=
                new SetPropertyEventHandler(OnSetVolume);

            m_InjectHandler.InjectCommand.OnCommand += new CommandEventHandler(OnInject);

            //Create ready property
            ITypeInt tReady = m_DDK.CreateInt(0, 1);

            //Add named values
            tReady.AddNamedValue("NotReady", 0);
            tReady.AddNamedValue("Ready", 1);
            m_ReadyProperty = m_Device.CreateStandardProperty(StandardPropertyID.Ready, tReady);
            m_ReadyProperty.Update(1);

            m_Device.OnBroadcast += new BroadcastEventHandler(OnBroadcast);
        }
예제 #11
0
        internal void Create(IDDK cmDDK, string deviceName)
        {
            m_DDK = cmDDK;

            ITypeInt tSignal = m_DDK.CreateInt(0, 1000);

            tSignal.Unit = "mAU";
            m_Channel    = m_DDK.CreateChannel(deviceName, "Detector device", tSignal);

            IStringProperty typeProperty =
                m_Channel.CreateProperty("DeviceType",
                                         "The DeviceType property tells us which component we are talking to.",
                                         m_DDK.CreateString(20));

            typeProperty.Update("Detector");

            m_Channel.AcquisitionOffCommand.OnCommand += new CommandEventHandler(OnAcqOff);
            m_Channel.AcquisitionOnCommand.OnCommand  += new CommandEventHandler(OnAcqOn);

            ITypeDouble tWavelength = m_DDK.CreateDouble(200, 400, 1);

            tWavelength.Unit     = "nm";
            m_WavelengthProperty = m_Channel.CreateStandardProperty(StandardPropertyID.Wavelength, tWavelength);
            m_WavelengthProperty.OnSetProperty += new SetPropertyEventHandler(OnSetWaveLength);

            // We want to have the wavelength available as a report variable and therefore add it to the channel info.
            m_Channel.AddPropertyToChannelInfo(m_WavelengthProperty);

            m_WavelengthProperty.Update(m_WaveLength);

            // What do we actually measure?
            m_Channel.PhysicalQuantity = "Absorbance";


            m_Timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
        }
예제 #12
0
 /// When we are connected, we update our model number.
 internal void OnConnect()
 {
     m_ModelNoProperty.Update("SendReceive Model");
 }
예제 #13
0
 internal void OnConnect()
 {
     m_ModelNoProperty.Update("Nelson NCI 900");
 }
 /// <summary>
 /// When we are connected, we update our status property.
 /// </summary>
 internal void OnConnect()
 {
     m_statusProperty.Update("Connected.");
 }
예제 #15
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;
            }
        }
예제 #16
0
        public HeaterProperties(IDDK ddk, Config.Heater config, IDevice device)
        {
            if (ddk == null)
            {
                throw new ArgumentNullException("ddk");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            Ready = Property.CreateReady(ddk, device);

            m_Product               = device.CreateStruct("Product", "Product Help Text");
            m_ProductName           = Property.CreateString(ddk, m_Product, "Name");
            m_ProductName.Writeable = true;
            m_ProductName.Update("Product Name");
            m_ProductDescription = Property.CreateString(ddk, m_Product, "Description");
            m_ProductDescription.Update(config.ProductDescription);
            // Set the default read and write properties for the structure - optional
            m_Product.DefaultGetProperty = m_ProductName;
            m_Product.DefaultSetProperty = m_ProductName;

            Power = Property.CreateDouble(ddk, device, "Power", UnitConversion.PhysUnitEnum.PhysUnit_Watt, null, 0);  // the unit W is localized

            // Temperature.Control - On/Off
            // Temperature.LowerLimit
            // Temperature.UpperLimit
            // Temperature.Nominal
            // Temperature.Value
            m_Temperature = device.CreateStruct("Temperature", "Heater Temperature");

            TemperatureControl           = Property.CreateEnum(ddk, m_Temperature, "Control", Heater.TemperatureControl.Off);
            TemperatureControl.Writeable = true;

            string    temperatureUnit      = UnitConversionEx.PhysUnitName(UnitConversion.PhysUnitEnum.PhysUnit_Celsius); // °C - localized
            const int temperaturePrecision = 1;

            ITypeDouble temperatureType = ddk.CreateDouble(0, 100, temperaturePrecision);

            temperatureType.Unit = temperatureUnit;

            TemperatureMin           = m_Temperature.CreateStandardProperty(StandardPropertyID.LowerLimit, temperatureType);
            TemperatureMin.Writeable = true;
            TemperatureMin.Update(20);

            TemperatureMax           = m_Temperature.CreateStandardProperty(StandardPropertyID.UpperLimit, temperatureType);
            TemperatureMax.Writeable = true;
            TemperatureMax.Update(80);

            TemperatureNominal           = m_Temperature.CreateStandardProperty(StandardPropertyID.Nominal, temperatureType); // Desired (requested) temperature
            TemperatureNominal.Writeable = true;
            TemperatureNominal.Update(50);

            temperatureType      = ddk.CreateDouble(double.MinValue, double.MaxValue, temperaturePrecision);
            temperatureType.Unit = temperatureUnit;
            TemperatureValue     = m_Temperature.CreateStandardProperty(StandardPropertyID.Value, temperatureType);
            TemperatureValue.Update(40);

            // Set the default read and write properties for the structure
            m_Temperature.DefaultGetProperty = TemperatureValue;
            m_Temperature.DefaultSetProperty = TemperatureNominal;
        }
예제 #17
0
 /// When we are connected, we initialize our properties.
 internal void OnConnect()
 {
     m_ModelNoProperty.Update("Preflight Model");
     m_someProperty.Update(0);
 }