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); }
public Detector(IDriverEx driver, IDDK ddk, Config.Detector config, string id) : base(driver, ddk, config, typeof(Detector).Name, id) { Log.TaskBegin(Id); try { m_Properties = new DetectorProperties(m_DDK, m_Device, config); m_Channels = new List <DetectorChannel>(); for (int i = 0; i < config.ChannelsNumber; i++) { int channelNumber = i + 1; UnitConversion.PhysUnitEnum unit = UnitConversion.PhysUnitEnum.PhysUnit_MilliAU; // mAU - Milli-Absorbance string channelPhysicalQuantity = "Absorbance"; // What do we actually measure bool channelNeedsIntegration = true; if (channelNumber == 2) { unit = UnitConversion.PhysUnitEnum.PhysUnit_MilliVolt; channelPhysicalQuantity = "Voltage"; channelNeedsIntegration = false; // This channel doesn't have peaks and, we don't want to have it integrated } string channelId = "Channel_" + channelNumber.ToString(CultureInfo.InvariantCulture); string channelName = channelId + "_Name"; DetectorChannel channel = new DetectorChannel(driver, ddk, m_Device, channelId, channelName, channelNumber, unit, channelNeedsIntegration, channelPhysicalQuantity); m_Channels.Add(channel); } ICommand command = m_Device.CreateCommand("AutoZero", string.Empty); command.OnCommand += OnCommandAutoZero; // Enable the scenario below: // Detector.Autozero // Wait Detector.Ready command.ImmediateNotReady = true; IsAutoZeroRunning = false; Log.TaskEnd(Id); } catch (Exception ex) { Log.TaskEnd(Id, ex); throw; } }
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); }
public DetectorChannel(IDriverEx driver, IDDK ddk, IDevice owner, string id, string channelName, int channelNumber, UnitConversion.PhysUnitEnum unit, bool channelNeedsIntegration, string channelPhysicalQuantity) : base(driver, ddk, typeof(DetectorChannel).Name, id, channelName, owner, CreateChannel(ddk, channelName, unit)) { m_Number = channelNumber; Log.TaskBegin(Id); try { if (owner == null) { throw new ArgumentNullException("owner"); } m_Channel = m_Device as IChannel; if (m_Channel == null) { if (m_Device == null) { throw new InvalidOperationException("The device is not created"); } if (m_Channel == null) { throw new InvalidOperationException("The device is type " + m_Device.GetType().FullName + " is not " + typeof(IChannel).FullName); } } m_Properties = new DetectorChannelProperties(m_DDK, m_Device, channelNumber, m_Channel); m_Channel.PhysicalQuantity = channelPhysicalQuantity; // What do we actually measure m_Channel.NeedsIntegration = channelNeedsIntegration; // If False then this channel doesn't have peaks and, we don't want to have it integrated Rate = 100; // Signal scaling m_Channel.SignalFactorProperty.Update(1); m_Properties.Wavelength.OnSetProperty += OnPropertyWaveLengthSet; m_Channel.AcquisitionOnCommand.OnPreflightCommand += OnCommandAcquisitionOnPreflight; m_Channel.AcquisitionOnCommand.OnCommand += OnCommandAcquisitionOn; m_Channel.AcquisitionOffCommand.OnPreflightCommand += OnCommandAcquisitionOffPreflight; m_Channel.AcquisitionOffCommand.OnCommand += OnCommandAcquisitionOff; m_Channel.OnDataFinished += OnChannelDataFinished; m_Driver.OnConnected += OnDriverConnected; m_Driver.OnDisconnected += OnDriverDisconnected; m_Timer = new System.Timers.Timer(1000); m_Timer.Elapsed += OnTimerElapsed; Log.TaskEnd(Id); } catch (Exception ex) { Log.TaskEnd(Id, ex); throw; } }
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; } }
public Pump(IDriverEx driver, IDDK ddk, Config.Pump config, string id) : base(driver, ddk, typeof(Pump).Name, id, config.Name) { Log.TaskBegin(Id); try { m_Properties = new PumpProperties(m_DDK, m_Device); m_Properties.PressureLowerLimit.OnSetProperty += OnPropertyPressureLowerLimitSet; m_Properties.PressureUpperLimit.OnSetProperty += OnPropertyPressureUpperLimitSet; // Properties of the flow handler: // m_FlowHandler.FlowNominalProperty - Flow.Nominal // m_FlowHandler.FlowValueProperty - Flow.Value // m_FlowHandler.ComponentProperties[i] (4 eluent component) - %A.Equate, %B.Equate, %C.Equate, %D.Equate // %A.Valuue, %B.Valuue; %C.Valuue; %D.Valuue ITypeDouble flowType = m_DDK.CreateDouble(0, 10, 3); flowType.Unit = UnitConversionEx.PhysUnitName(UnitConversion.PhysUnitEnum.PhysUnit_MilliLiterPerMin); // ml/min m_FlowHandler = m_Device.CreateFlowHandler(flowType, 4, 2); m_FlowHandler.FlowNominalProperty.OnPreflightSetProperty += OnPropertyFlowNominalSetPreflight; m_FlowHandler.FlowNominalProperty.OnSetProperty += OnPropertyFlowNominalSet; m_FlowHandler.FlowNominalProperty.OnSetRamp += OnPropertyFlowNominalSetRamp; //m_FlowHandler.FlowNominalProperty.RampSyntax = true; // m_FlowHandler.FlowNominalProperty.IsRampSyntax is already True m_FlowHandler.FlowNominalProperty.Update(0); //m_FlowHandler.FlowValueProperty.RampSyntax = true; // m_FlowHandler.FlowValueProperty.IsRampSyntax is already True m_FlowHandler.FlowValueProperty.Update(0); m_EluentPercentA = 100; m_FlowHandler.ComponentProperties[0].Update(m_EluentPercentA); // Partial flow of this component, expressed in percent of the total flow. m_FlowHandler.EquateProperties[i].HelpText = "User-selectable designation of this solvent component." m_FlowHandler.ComponentProperties[1].Update(m_EluentPercentB); m_FlowHandler.ComponentProperties[2].Update(m_EluentPercentC); m_FlowHandler.ComponentProperties[3].Update(m_EluentPercentD); m_FlowHandler.EquateProperties[0].Update("Water"); m_FlowHandler.ComponentProperties[1].OnSetProperty += OnPropertyFlowHandler_ComponentProperty_2_Set; m_FlowHandler.ComponentProperties[2].OnSetProperty += OnPropertyFlowHandler_ComponentProperty_3_Set; m_FlowHandler.ComponentProperties[3].OnSetProperty += OnPropertyFlowHandler_ComponentProperty_4_Set; double pressureSignalMin = m_Properties.PressureLowerLimit.Value.GetValueOrDefault(); double pressureSignalMax = m_Properties.PressureUpperLimit.Value.GetValueOrDefault(); int pressureSignalDigits = 3; string pressureUnitName = m_Properties.PressureValue.DataType.Unit; UnitConversion.PhysUnitEnum pressureUnit = UnitConversionEx.PhysUnitFindName(pressureUnitName); m_ChannelPressure = new PumpChannelPressure(driver, ddk, m_Device, "Channel_Pressure_Id", "Channel_Pressure_Name", pressureSignalMin, pressureSignalMax, pressureSignalDigits, pressureUnit); m_Device.OnBatchPreflightBegin += OnDeviceBatchPreflightBegin; m_Device.OnBatchPreflightSample += OnDeviceBatchPreflightSample; m_Device.OnBatchPreflightEnd += OnDeviceBatchPreflightEnd; m_Device.OnPreflightBegin += OnDevicePreflightBegin; m_Device.OnPreflightLatch += OnDevicePreflightLatch; m_Device.OnPreflightSync += OnDevicePreflightSync; m_Device.OnPreflightBroadcast += OnDevicePreflightBroadcast; m_Device.OnPreflightEnd += OnDevicePreflightEnd; m_Device.OnTransferPreflightToRun += OnDeviceTransferPreflightToRun; m_Device.OnLatch += OnDeviceLatch; m_Device.OnSync += OnDeviceSync; // See these in the AutoSampler m_Device.OnSequenceStart += OnDeviceSequenceStart; m_Device.OnSequenceChange += OnDeviceSequenceChange; m_Device.OnSequenceEnd += OnDeviceSequenceEnd; m_Device.OnBroadcast += OnDeviceBroadcast; Log.TaskEnd(Id); } catch (Exception ex) { Log.TaskEnd(Id, ex); throw; } }
public DetectorChannel(IDriverEx driver, IDDK ddk, IDevice owner, string id, string channelName, int channelNumber, UnitConversion.PhysUnitEnum unit, bool channelNeedsIntegration, string channelPhysicalQuantity) : base(driver, ddk, typeof(DetectorChannel).Name, id, channelName, owner, CreateChannel(ddk, channelName, unit)) { m_Number = channelNumber; }
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); }
public PumpChannelPressure(IDriverEx driver, IDDK ddk, IDevice owner, string id, string channelName, double signalMin, double signalMax, int signalDigits, UnitConversion.PhysUnitEnum unit) : base(driver, ddk, typeof(DetectorChannel).Name, id, channelName, owner, CreateChannel(ddk, channelName, signalMin, signalMax, signalDigits, unit)) { Log.TaskBegin(Id); try { if (owner == null) { throw new ArgumentNullException("owner"); } m_Channel = m_Device as IChannel; if (m_Channel == null) { if (m_Device == null) { throw new InvalidOperationException("The device is not created"); } if (m_Channel == null) { throw new InvalidOperationException("The device is type " + m_Device.GetType().FullName + " is not " + typeof(IChannel).FullName); } } m_Properties = new PumpChannelPressureProperties(m_DDK, m_Device, m_Channel); m_Channel.PhysicalQuantity = "Pressure"; // What do we actually measure m_Channel.NeedsIntegration = false; // If False then this channel doesn't have peaks and, we don't want to have it integrated m_Channel.AcquisitionOnCommand.OnCommand += OnCommandAcquisitionOn; m_Channel.AcquisitionOffCommand.OnCommand += OnCommandAcquisitionOff; m_Channel.OnDataFinished += OnChannelDataFinished; m_Driver.OnConnected += OnDriverConnected; m_Driver.OnDisconnected += OnDriverDisconnected; Log.TaskEnd(Id); } catch (Exception ex) { Log.TaskEnd(Id, ex); throw; } }