public Heater(IDriverEx driver, IDDK ddk, Config.Heater config, string id) : base(driver, ddk, config, typeof(Heater).Name, id) { Log.TaskBegin(Id); try { m_Properties = new HeaterProperties(m_DDK, config, m_Device); // Enable the scenario below: // Heater.TemperatureNominal N // Wait Heater.Ready m_Properties.TemperatureNominal.ImmediateNotReady = true; m_Properties.TemperatureControl.OnSetProperty += OnPropertyTemperatureControlSet; m_Properties.TemperatureNominal.OnPreflightSetProperty += OnPropertyTemperatureNominalSetPreflight; m_Properties.TemperatureNominal.OnSetProperty += OnPropertyTemperatureNominalSet; m_Device.OnPreflightSync += OnDevicePreflightSync; 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; 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 Demo(IDriverEx driver, IDDK ddk, Config.Demo config, string id, InstrumentDataList instrumentDataList, string driverFolder) : base(driver, ddk, config, typeof(Demo).Name, id) { Log.TaskBegin(Id); try { if (string.IsNullOrEmpty(driverFolder)) { throw new ArgumentNullException("driverFolder"); } if (instrumentDataList == null) { throw new ArgumentNullException("instrumentDataList"); } m_Properties = new DemoProperties(driver, m_DDK, config, m_Device); //------------------------------------------------------------------------------------------------------------------- if (m_DDK.InstrumentMap == null) { throw new InvalidOperationException("DDK.InstrumentMap is Null"); } long instrumentsMap = m_DDK.InstrumentMap.Value; if (instrumentsMap == (long)InstrumentID.None) { throw new InvalidOperationException("DDK.InstrumentMap = " + instrumentsMap.ToString() + " must be != " + ((long)InstrumentID.None).ToString()); } string instrumentsMapBinary = InstrumentData.GetBitMapBinary(instrumentsMap); string instrumentsNames = instrumentDataList.GetNames(); bool logInFile = LogInFile; string fileNamePrefix = instrumentDataList[0].Name; Log.Init(Id, logInFile, fileNamePrefix); // Logging in a file starts here, if logInFile is True const string indent = "\t"; string text = Environment.NewLine + Environment.NewLine + indent + "Driver Folder \"" + driverFolder + "\"" + Environment.NewLine + indent + "Name \"" + Name + "\", IsSimulated = " + IsSimulated.ToString() + Environment.NewLine + indent + "USB Address \"" + UsbAddress + "\"" + Environment.NewLine + indent + "DDK.InstrumentMap = " + instrumentsMap.ToString() + " = " + instrumentsMapBinary + " = " + instrumentsNames + Environment.NewLine; Log.WriteLine(Id, text); //------------------------------------------------------------------------------------------------------------------- m_Properties.LogInFile.OnSetProperty += OnPropertyLogInFileSet; //------------------------------------------------------------------------------------------------------------------- CommandTestInit(); CommandStartStopInit(); Log.TaskEnd(Id); } catch (Exception ex) { Log.TaskEnd(Id, ex); throw; } }
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); }
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; } }
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; } }
public AutoSampler(IDriverEx driver, IDDK ddk, Config.AutoSampler config, string id) : base(driver, ddk, typeof(AutoSampler).Name, id, config.Name) { }
//private readonly DetectorProperties m_Properties; //private readonly List<DetectorChannel> m_Channels; public Detector(IDriverEx driver, IDDK ddk, Config.Detector config, string id) : base(driver, ddk, config, typeof(Detector).Name, id) { }
public Device(IDriverEx driver, IDDK ddk, string deviceType, string id, string name, IDevice owner = null, IDevice device = null) { if (driver == null) { throw new ArgumentNullException("driver"); } if (ddk == null) { throw new ArgumentNullException("ddk"); } if (string.IsNullOrEmpty(deviceType)) { throw new ArgumentNullException("deviceType"); } if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException("id"); } if (id.Length != id.Trim().Length) { throw new ArgumentException("id \"" + id + "\" is invalid - it starts or ends with a space"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (name.Length != name.Trim().Length) { throw new ArgumentException("name \"" + name + "\" is invalid - it starts or ends with a space"); } m_Driver = driver; m_DDK = ddk; m_Id = id; m_Name = name; Log.TaskBegin(Id, "Name = \"" + Name + "\""); try { m_IsSimulated = m_Driver.IsSimulated; m_Device = device; if (m_Device == null) { m_Device = m_DDK.CreateDevice(Name, "Help text for device " + Id + " with name \"" + Name + "\""); } if (owner != null) { m_Device.SetOwner(owner); } m_Properties = new DeviceProperties(m_DDK, m_Device, Id, deviceType, Name); m_Properties.Description.OnPreflightSetProperty += OnPropertyDescriptionSetPreflight; m_Properties.Description.OnSetProperty += OnPropertyDescriptionSet; // The Debug.Assert problem fixed in VS 2017, but the debugger must be already attached - else nothing happens Debug.Assert(!string.IsNullOrEmpty(Name)); bool debuggerBreak = false; if (debuggerBreak) { DebuggerBreak("Test debugger break"); } bool breakIfDebuggerIsAttached = false; if (breakIfDebuggerIsAttached) { DebuggerBreakIfIsAttached("Test debugger break is it's attached"); } Log.TaskEnd(Id); } catch (Exception ex) { Log.TaskEnd(Id, ex); throw; } }
public Device(IDriverEx driver, IDDK ddk, Config.Device config, string deviceType, string id, IDevice owner = null, IDevice device = null) : this(driver, ddk, deviceType, id, config.Name, owner, device) { }
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; }
public Pump(IDriverEx driver, IDDK ddk, Config.Pump config, string id) : base(driver, ddk, typeof(Pump).Name, id, config.Name) { }
public Heater(IDriverEx driver, IDDK ddk, Config.Heater config, string id) : base(driver, ddk, config, typeof(Heater).Name, id) { }