Пример #1
0
        private static IDevice CreateChannel(IDDK ddk, string name, UnitConversion.PhysUnitEnum unit)
        {
            ITypeInt typeSignal = ddk.CreateInt(0, 1000);

            typeSignal.Unit = UnitConversionEx.PhysUnitName(unit);
            IChannel result = ddk.CreateChannel(name, "Detector channel", typeSignal);

            return(result);
        }
        /// Create our Chromeleon symbols
        internal IChannel OnCreate(IDDK cmDDK, IDevice master, string name)
        {
            // Create a data type for our signal
            ITypeDouble tSignal = cmDDK.CreateDouble(-100.0, 100.0, 1);

            tSignal.Unit = "mV";

            // Create the channel symbol
            m_MyCmDevice = cmDDK.CreateChannel(name, "Channel that can generate both sinus curve and sawtooth signal as Int64 data points.", tSignal);
            // We will be a subdevice of the master device
            m_MyCmDevice.SetOwner(master);

            // Attach our handlers to the AcquisitionOffCommand and AcquisitionOnCommand of the channel
            m_MyCmDevice.AcquisitionOffCommand.OnCommand += new CommandEventHandler(OnAcqOff);
            m_MyCmDevice.AcquisitionOnCommand.OnCommand  += new CommandEventHandler(OnAcqOn);

            m_MyCmDevice.OnDataFinished += new DataFinishedEventHandler(m_MyCmDevice_OnDataFinished);

            // These two parameters are not longer relevant when using the new UpdateDataEx function
            // in contradiction to the old UpdateData interface. So leave these parameters unchanged;
            // the DDK will initialize them appropriately.
            m_MyCmDevice.TimeStepFactorProperty.Writeable  = false;
            m_MyCmDevice.TimeStepDivisorProperty.Writeable = false;

            ITypeDouble tRateType = cmDDK.CreateDouble(0.1, 1000.0, 1);

            tRateType.Unit = "Hz";
            m_RateProperty = m_MyCmDevice.CreateProperty("FixedRate", "The data collection rate in Hz.", tRateType);
            m_RateProperty.OnSetProperty += new SetPropertyEventHandler(m_RateProperty_OnSetProperty);

            ITypeInt tDataIndexType = cmDDK.CreateInt(0, int.MaxValue);

            m_DataIndexProperty =
                m_MyCmDevice.CreateProperty("TotalDataPoints", "Total number of data points.", tDataIndexType);

            ICommand noMoreDataCommand = m_MyCmDevice.CreateCommand("NoMoreData", "Send IChannel.NoMoreData to stop data acquisition immediately.");

            noMoreDataCommand.OnCommand += new CommandEventHandler(noMoreDataCommand_OnCommand);

            ITypeDouble tChannelTimeType = cmDDK.CreateDouble(0, 1000, 3);

            tChannelTimeType.Unit = "min";
            m_ChannelTimeProperty =
                m_MyCmDevice.CreateProperty("ChannelTime", "Internal time of the channel.", tChannelTimeType);

            // This channel doesn't have peaks, we don't want to have it integrated.
            m_MyCmDevice.NeedsIntegration = false;

            return(m_MyCmDevice);
        }
Пример #3
0
        /// Create our Chromeleon symbols
        internal IChannel Create(IDDK cmDDK, string name)
        {
            // Create a data type for our signal
            ITypeInt tSignal = cmDDK.CreateInt(-100, 100);

            tSignal.Unit = "mV";

            // Create the channel symbol
            m_MyCmDevice = cmDDK.CreateChannel(name, "This is a channel that can generate a sinus curve.", tSignal);

            // Attach our handlers to the AcquisitionOffCommand and AcquisitionOnCommand of the channel
            m_MyCmDevice.AcquisitionOffCommand.OnCommand += new CommandEventHandler(OnAcqOff);
            m_MyCmDevice.AcquisitionOnCommand.OnCommand  += new CommandEventHandler(OnAcqOn);

            m_MyCmDevice.TimeStepFactorProperty.DataType.Minimum = 100;
            m_MyCmDevice.TimeStepFactorProperty.DataType.Maximum = 100;
            m_MyCmDevice.TimeStepFactorProperty.Writeable        = false;

            m_MyCmDevice.TimeStepDivisorProperty.DataType.Minimum = 1;
            m_MyCmDevice.TimeStepDivisorProperty.DataType.Maximum = 100;
            m_MyCmDevice.TimeStepDivisorProperty.OnSetProperty   += new SetPropertyEventHandler(OnTimeStepDivisor);

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

            tWavelength.Unit     = "nm";
            m_WavelengthProperty = m_MyCmDevice.CreateStandardProperty(StandardPropertyID.Wavelength, tWavelength);

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

            // What do we actually measure?
            m_MyCmDevice.PhysicalQuantity = "MotorCurrent";

            // This channel doesn't have peaks, we don't want to have it integrated.
            m_MyCmDevice.NeedsIntegration = false;

            // Create a command for writing a spectrum
            ICommand writeSpectrumCommand = m_MyCmDevice.CreateCommand("WriteSpectrum", "Write a spectrum");

            writeSpectrumCommand.OnCommand += new CommandEventHandler(OnWriteSpectrum);

            // Create an interface for spectrum writing
            m_SpectrumWriter = m_MyCmDevice.CreateSpectrumWriter();

            return(m_MyCmDevice);
        }
Пример #4
0
        /// <summary>
        /// Create our Dionex.Chromeleon.Symbols.IChannel 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 IChannel Create(IDDK cmDDK, string name)
        {
            ITypeInt tSignal = cmDDK.CreateInt(-1000, 1000);

            m_MyCmDevice = cmDDK.CreateChannel(name, "Nelson NCI 900 Channel", tSignal);

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

            m_MyCmDevice.TimeStepFactorProperty.DataType.Minimum = 100;
            m_MyCmDevice.TimeStepFactorProperty.DataType.Maximum = 100;
            m_MyCmDevice.TimeStepFactorProperty.Writeable        = false;

            m_MyCmDevice.TimeStepDivisorProperty.DataType.Minimum = 1;
            m_MyCmDevice.TimeStepDivisorProperty.DataType.Maximum = 100;
            m_MyCmDevice.TimeStepDivisorProperty.OnSetProperty   += new SetPropertyEventHandler(OnTimeStepDivisor);

            return(m_MyCmDevice);
        }
Пример #5
0
        internal IChannel Create(IDDK cmDDK, string name)
        {
            // Create a data type for our signal
            ITypeInt tSignal = cmDDK.CreateInt(-100, 100);

            // Create the channel symbol
            m_MyCmDevice = cmDDK.CreateChannel(name, "This is a channel that can generate a sinus curve.", tSignal);

            // Attach our handlers to the AcquisitionOffCommand and AcquisitionOnCommand of the channel
            m_MyCmDevice.AcquisitionOffCommand.OnCommand += new CommandEventHandler(OnAcqOff);
            m_MyCmDevice.AcquisitionOnCommand.OnCommand  += new CommandEventHandler(OnAcqOn);

            m_MyCmDevice.TimeStepFactorProperty.DataType.Minimum = 1;
            m_MyCmDevice.TimeStepFactorProperty.DataType.Maximum = 1;
            m_MyCmDevice.TimeStepFactorProperty.Writeable        = false;

            m_MyCmDevice.TimeStepDivisorProperty.DataType.Minimum = 1;
            m_MyCmDevice.TimeStepDivisorProperty.DataType.Maximum = 1;
            m_MyCmDevice.TimeStepDivisorProperty.Writeable        = false;

            m_dcr = m_MyCmDevice.CreateProperty("Data_Collection_Rate", "This is the data collection rate of the device", cmDDK.CreateDouble(0.1, 300.0, 1));
            m_dcr.OnPreflightSetProperty += new SetPropertyEventHandler(m_dcr_OnPreflightSetProperty);
            m_dcr.OnSetProperty          += new SetPropertyEventHandler(m_dcr_OnSetProperty);

            ITypeInt dcrModeType = cmDDK.CreateInt(0, 1);

            dcrModeType.AddNamedValue("Regular", 0);
            dcrModeType.AddNamedValue("Random", 1);

            m_dcrmode = m_MyCmDevice.CreateProperty("DCRMode", "Mode in which the data points are sent - regular interval or arbitrary", dcrModeType);
            m_dcrmode.OnSetProperty          += new SetPropertyEventHandler(m_dcrmode_OnSetProperty);
            m_dcrmode.OnPreflightSetProperty += new SetPropertyEventHandler(m_dcrmode_OnPreflightSetProperty);

            ITypeInt signalTypeType = cmDDK.CreateInt(0, 1);

            signalTypeType.AddNamedValue("SawTooth", 0);
            signalTypeType.AddNamedValue("Sinus", 1);
            m_signalType = m_MyCmDevice.CreateProperty("SignalType", "The signal type of the simulation mode data - SawTooth or Sinus (frequency 0.1Hz)", signalTypeType);
            m_signalType.OnSetProperty += new SetPropertyEventHandler(m_signalType_OnSetProperty);

            return(m_MyCmDevice);
        }
Пример #6
0
        private static IDevice CreateChannel(IDDK ddk, string name, UnitConversion.PhysUnitEnum unit)
        {
            if (ddk == null)
            {
                throw new ArgumentNullException("ddk");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
            if (unit == UnitConversion.PhysUnitEnum.PhysUnit_Unknown)
            {
                throw new ArgumentException("The unit mus be specified");
            }

            ITypeInt typeSignal = ddk.CreateInt(0, 1000);

            typeSignal.Unit = UnitConversionEx.PhysUnitName(unit);
            IChannel result = ddk.CreateChannel(name, "Detector channel", typeSignal);

            return(result);
        }
Пример #7
0
        private static IDevice CreateChannel(IDDK ddk, string name, double min, double max, int digits, UnitConversion.PhysUnitEnum unit)
        {
            if (ddk == null)
            {
                throw new ArgumentNullException("ddk");
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }
            if (unit == UnitConversion.PhysUnitEnum.PhysUnit_Unknown)
            {
                throw new ArgumentException("The unit mus be specified");
            }

            ITypeDouble typeSignal = ddk.CreateDouble(min, max, digits);

            typeSignal.Unit = UnitConversionEx.PhysUnitName(unit);
            IChannel result = ddk.CreateChannel(name, "Pump Pressure Channel", typeSignal);

            return(result);
        }
Пример #8
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);
        }
Пример #9
0
        /// Create our Chromeleon symbols
        internal IChannel OnCreate(IDDK cmDDK, IDevice master, string name)
        {
            // Create a data type for our signal
            ITypeDouble tSignal = cmDDK.CreateDouble(-100.0, 100.0, 1);

            tSignal.Unit = "mV";

            // Create the channel symbol
            m_MyCmDevice = cmDDK.CreateChannel(name, "This is a channel that can generate a sinus curve.", tSignal);
            // We will be a subdevice of the master device
            m_MyCmDevice.SetOwner(master);

            // Attach our handlers to the AcquisitionOffCommand and AcquisitionOnCommand of the channel
            m_MyCmDevice.AcquisitionOffCommand.OnCommand += new CommandEventHandler(OnAcqOff);
            m_MyCmDevice.AcquisitionOnCommand.OnCommand  += new CommandEventHandler(OnAcqOn);

            m_MyCmDevice.OnDataFinished += new DataFinishedEventHandler(m_MyCmDevice_OnDataFinished);

            // Usually, TimeStepFactor and TimeStepFactor are read-only properties and the driver updates them.
            // In this driver we allow to change these values manually for illustration purposes.
            m_MyCmDevice.TimeStepFactorProperty.DataType.Minimum = 1;
            m_MyCmDevice.TimeStepFactorProperty.DataType.Maximum = 10000;
            m_MyCmDevice.TimeStepFactorProperty.OnSetProperty   += new SetPropertyEventHandler(TimeStepFactorProperty_OnSetProperty);

            m_MyCmDevice.TimeStepDivisorProperty.DataType.Minimum = 1;
            m_MyCmDevice.TimeStepDivisorProperty.DataType.Maximum = 10000;
            m_MyCmDevice.TimeStepDivisorProperty.OnSetProperty   += new SetPropertyEventHandler(TimeStepDivisorProperty_OnSetProperty);

            ITypeDouble tRateType = cmDDK.CreateDouble(0.1, 1000.0, 1);

            tRateType.Unit = "Hz";
            m_RateProperty = m_MyCmDevice.CreateProperty("FixedRate", "The data collection rate in Hz.", tRateType);
            m_RateProperty.OnSetProperty += new SetPropertyEventHandler(m_RateProperty_OnSetProperty);

            // We want to have the FixedRate available as a report variable and therefore add it to the channel info.
            m_MyCmDevice.AddPropertyToChannelInfo(m_RateProperty);

            ITypeInt tDataIndexType = cmDDK.CreateInt(0, int.MaxValue);

            m_DataIndexProperty =
                m_MyCmDevice.CreateProperty("TotalDataPoints", "Total number of data points.", tDataIndexType);

            ICommand noMoreDataCommand = m_MyCmDevice.CreateCommand("NoMoreData", "Send IChannel.NoMoreData to stop data acquisition immediately.");

            noMoreDataCommand.OnCommand += new CommandEventHandler(noMoreDataCommand_OnCommand);

            ITypeDouble tChannelTimeType = cmDDK.CreateDouble(0, 1000, 3);

            tChannelTimeType.Unit = "min";
            m_ChannelTimeProperty =
                m_MyCmDevice.CreateProperty("ChannelTime", "Internal time of the channel.", tChannelTimeType);

            // What do we actually measure?
            m_MyCmDevice.PhysicalQuantity = "MotorCurrent";

            // This channel doesn't have peaks, we don't want to have it integrated.
            m_MyCmDevice.NeedsIntegration = false;

            // Create a command for writing a spectrum
            ICommand writeSpectrumCommand = m_MyCmDevice.CreateCommand("WriteSpectrum", "Write a spectrum");

            writeSpectrumCommand.OnCommand += new CommandEventHandler(OnWriteSpectrum);

            // Create an interface for spectrum writing
            m_SpectrumWriter = m_MyCmDevice.CreateSpectrumWriter();

            return(m_MyCmDevice);
        }