示例#1
0
        void m_Device_OnPreflightEnd(PreflightEventArgs args)
        {
            String message = String.Format("Device.OnPreflightEnd({0}) called", args.RunContext);

            m_Device.AuditMessage(AuditLevel.Warning, message);

            IProgramSteps steps = args.RunContext.ProgramSteps;

            message = String.Format("ProgramSteps count: {0}", steps.Count);
            m_Device.AuditMessage(AuditLevel.Warning, message);
            foreach (IProgramStep step in steps)
            {
                IPropertyAssignmentStep paStep = step as IPropertyAssignmentStep;
                if (paStep != null)
                {
                    message = String.Format("Assignment at time {0} for property {1}", paStep.Retention.Minutes, paStep.Property.Name);
                }
                ILatchStep lStep = step as ILatchStep;
                if (lStep != null)
                {
                    message = String.Format("Latch at time {0}", lStep.Retention);
                }
                ISyncStep sStep = step as ISyncStep;
                if (sStep != null)
                {
                    message = String.Format("Sync at time {0}", sStep.Retention);
                }
                IRampStep rStep = step as IRampStep;
                if (rStep != null)
                {
                    message = String.Format("Ramp at time {0}", rStep.Retention);
                }
                m_Device.AuditMessage(AuditLevel.Warning, message);
            }
        }
示例#2
0
        private void OnDevicePreflightSync(PreflightEventArgs args)
        {
            try
            {
                Property.Preflight preflight = new Property.Preflight(args.RunContext);

                // These values are taken from the script
                Nullable <double> temperatureMin = preflight.GetCurrentValue(m_Properties.TemperatureMin);
                Nullable <double> temperatureMax = preflight.GetCurrentValue(m_Properties.TemperatureMax);
                if (temperatureMin == null)
                {
                    throw new InvalidOperationException(m_Properties.TemperatureMin.Name + " is not set");
                }
                if (temperatureMax == null)
                {
                    throw new InvalidOperationException(m_Properties.TemperatureMax.Name + " is not set");
                }
                if (temperatureMin > temperatureMax)
                {
                    throw new InvalidOperationException("Invalid temperature limits: " + m_Properties.TemperatureMin.Name + " " + temperatureMin.ToString() + " > " +
                                                        m_Properties.TemperatureMax.Name + " " + temperatureMax.ToString());
                }
            }
            catch (Exception ex)
            {
                AuditMessage(AuditLevel.Error, ex.Message);
            }
        }
示例#3
0
        private void OnDevicePreflightSync(PreflightEventArgs args)
        {
            try
            {
                Log.WriteLine(Id, "ProgramTime.Minutes = " + args.RunContext.ProgramTime.Minutes.ToString());

                Property.Preflight preflight = new Property.Preflight(args.RunContext);

                Nullable <double> pressureLimitMin = preflight.GetCurrentValue(m_Properties.PressureLowerLimit);
                Nullable <double> pressureLimitMax = preflight.GetCurrentValue(m_Properties.PressureUpperLimit);
                if (pressureLimitMin == null)
                {
                    throw new InvalidOperationException(m_Properties.PressureLowerLimit.Name + " is not set");
                }
                if (pressureLimitMax == null)
                {
                    throw new InvalidOperationException(m_Properties.PressureUpperLimit.Name + " is not set");
                }
                if (pressureLimitMin > pressureLimitMax)
                {
                    throw new InvalidOperationException("Invalid pressure limits: " + m_Properties.PressureLowerLimit.Name + " " + pressureLimitMin.ToString() + " > " +
                                                        m_Properties.PressureUpperLimit.Name + " " + pressureLimitMax.ToString());
                }
            }
            catch (Exception ex)
            {
                AuditMessage(AuditLevel.Error, ex.Message);
            }
        }
示例#4
0
        private void OnTransferPfToRun(PreflightEventArgs args)
        {
            m_MyCmDevice.AuditMessage(AuditLevel.Message, args.RunContext.ProgramTime.Minutes.ToString() + " min: OnTransferPreflightToRun handler OnTransferPfToRun, please wait...");

            Thread.Sleep(2000);

            m_MyCmDevice.AuditMessage(AuditLevel.Message, args.RunContext.ProgramTime.Minutes.ToString() + " min: OnTransferPreflightToRun handler OnTransferPfToRun has finished.");
        }
        void OnPreflightEnd(PreflightEventArgs args)
        {
            // Report the blob content
            if (args.RunContext.IsSemanticCheck || args.RunContext.IsReadyCheck)
            {
                m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnPreflightEnd handler");

                ReportBlob(args.RunContext);
            }
        }
        /// <summary>
        /// OnTransferPfToRun is called when the previously preflighted instrument method is actually started.
        /// </summary>
        /// <param name="args">The PreflightEventArgs contain the IRunContext with the ProgramSteps.</param>
        private void OnTransferPfToRun(PreflightEventArgs args)
        {
            m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnTransferPreflightToRun.");

            // Report the blob content
            if (args.RunContext.IsSample)
            {
                ReportBlob(args.RunContext);
            }
        }
示例#7
0
        private void OnDevicePreflightEnd(PreflightEventArgs args)
        {
            Log.WriteLine(Id, "ProgramTime.Minutes = " + args.RunContext.ProgramTime.Minutes.ToString());

            // Check everything
            foreach (IProgramStep step in args.RunContext.ProgramSteps)
            {
                IRampStep rampStep = step as IRampStep;
                if (rampStep == null)
                {
                    continue;
                }

                m_IsRamped = true;
                RetentionTime        duration   = rampStep.Duration;
                IDoublePropertyValue startValue = rampStep.StartValue as IDoublePropertyValue;
                IDoublePropertyValue endValue   = rampStep.EndValue as IDoublePropertyValue;
            }
        }
示例#8
0
        private void OnTransferPreflightToRun(PreflightEventArgs args)
        {
            // We use the IProgramStep interface to walk the list of events in the instrument method.
            // In a real driver we would need to build some kind of time table and send it to the hardware.
            // In this example we create a list instead and write it to the audit trail.
            // Note that the property is not updated, as this would be done asynchronously during the run.

            StringBuilder sb = new StringBuilder("Table of timed events:\n");

            foreach (IProgramStep step in args.RunContext.ProgramSteps)
            {
                IRampStep rampStep = step as IRampStep;

                if (rampStep != null)
                {
                    RetentionTime        duration   = rampStep.Duration;
                    IDoublePropertyValue startValue = rampStep.StartValue as IDoublePropertyValue;
                    IDoublePropertyValue endValue   = rampStep.EndValue as IDoublePropertyValue;

                    sb.Append("Retention ");
                    sb.Append(step.Retention.Minutes.ToString("F3"));
                    sb.Append(": ");
                    sb.Append(startValue.Property.Owner.Name);
                    sb.Append(".");
                    sb.Append(startValue.Property.Name);
                    sb.Append("=");
                    sb.Append(startValue.Value.Value.ToString("F3"));
                    sb.Append(", ");
                    sb.Append(endValue.Property.Owner.Name);
                    sb.Append(".");
                    sb.Append(endValue.Property.Name);
                    sb.Append("=");
                    sb.Append(endValue.Value.Value.ToString("F3"));
                    sb.Append(", Duration=");
                    sb.Append(duration.Minutes.ToString("F3"));
                    sb.Append("\n");
                }
            }

            m_Device.AuditMessage(AuditLevel.Message, sb.ToString());
        }
        /// <summary>
        /// OnTransferPfToRun is called when the previously preflighted instrument method is actually started.
        /// </summary>
        /// <param name="args">The PreflightEventArgs contain the IRunContext with the ProgramSteps.</param>
        private void OnTransferPfToRun(PreflightEventArgs args)
        {
            m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnTransferPreflightToRun handler OnTransferPfToRun, please wait...");

            // We use the IProgramStep interface to walk the list of events in the instrument method.
            // In a real driver we would need to build some kind of time table and send it to the hardware.
            // In this example we create a list instead and write it to the audit trail.
            // Note that the property is not updated, as this would be done asynchronously during the run.

            StringBuilder sb = new StringBuilder("Table of timed events:\n");

            foreach (IProgramStep step in args.RunContext.ProgramSteps)
            {
                IPropertyAssignmentStep propertyAssignment = step as IPropertyAssignmentStep;

                if (propertyAssignment != null)
                {
                    if (propertyAssignment.Value.Property == m_EventAProperty ||
                        propertyAssignment.Value.Property == m_EventBProperty)
                    {
                        IIntPropertyValue value = propertyAssignment.Value as IIntPropertyValue;

                        sb.Append("Retention ");
                        sb.Append(step.Retention.Minutes.ToString("F3"));
                        sb.Append(": ");
                        sb.Append(propertyAssignment.Value.Property.Name);
                        sb.Append("=");
                        sb.Append(value.Value.ToString());
                        sb.Append("\n");
                    }
                }
            }

            m_MyCmDevice.AuditMessage(AuditLevel.Message, sb.ToString());

            m_MyCmDevice.AuditMessage(AuditLevel.Message, "OnTransferPreflightToRun handler OnTransferPfToRun has finished.");
        }
示例#10
0
        private void OnDeviceTransferPreflightToRun(PreflightEventArgs args)
        {
            Log.WriteLine(Id, "ProgramTime.Minutes = " + args.RunContext.ProgramTime.Minutes.ToString());

            if (m_CurrentSequence == null)
            {
                return;
            }

            bool hasCommandStep = false;

            foreach (IProgramStep step in args.RunContext.ProgramSteps)
            {
                hasCommandStep = step is ICommandStep;
                if (hasCommandStep)
                {
                    break;
                }
            }
            if (!hasCommandStep)
            {
                return;
            }

            bool lockNextInjection = false;

            if (lockNextInjection)
            {
                // if injection overlap - lock the next injection
                if (m_CurrentSequence.RunningIndex + 1 < m_CurrentSequence.Samples.Count)
                {
                    m_CurrentSequence.LastPreparingIndex = m_CurrentSequence.RunningIndex + 1;  // Lock next injection
                    //m_CurrentSequence.LastPreparingIndex = m_CurrentSequence.Samples.Count - 1;  // Lock all injections
                }
            }
        }
 void m_MyCmDevice_OnTransferPreflightToRun(PreflightEventArgs args)
 {
     m_MyCmDevice.AuditMessage(AuditLevel.Warning, "OnTransferPfToRun handler");
 }
 void m_MyCmDevice_OnPreflightEnd(PreflightEventArgs args)
 {
     m_MyCmDevice.AuditMessage(AuditLevel.Warning, "OnPreflightEnd handler");
 }
示例#13
0
 /// <summary>
 /// We use OnTransferPreflightToRun to find out the end time of the instrument method.
 /// Usually our run should end shortly after that time.
 /// </summary>
 /// <param name="args"></param>
 void m_MyCmDevice_OnTransferPreflightToRun(PreflightEventArgs args)
 {
     m_EndTime = args.RunContext.ProgramTime;
 }
示例#14
0
 private void OnDevicePreflightEnd(PreflightEventArgs args)
 {
     m_InstrumentMethodToalTimeMin = args.RunContext.ProgramTime.Minutes;
 }
示例#15
0
 private void OnPfSync(PreflightEventArgs args)
 {
     m_MyCmDevice.AuditMessage(AuditLevel.Warning, args.RunContext.ProgramTime.Minutes.ToString() + " min: OnPreflightSync handler OnPfSync");
 }
示例#16
0
        void m_Device_OnTransferPreflightToRun(PreflightEventArgs args)
        {
            String message = String.Format("Device.OnTransferPreflightToRun({0}) called", args.RunContext);

            m_Device.AuditMessage(AuditLevel.Normal, message);
        }
示例#17
0
        private void OnDeviceTransferPreflightToRun(PreflightEventArgs args)
        {
            Log.WriteLine(Id, "ProgramTime.Minutes = " + args.RunContext.ProgramTime.Minutes.ToString());

            m_IsRamped = false;

            // Iterate  through each IProgramStep from the instrument method
            bool isIsocratic = false;

            foreach (IProgramStep step in args.RunContext.ProgramSteps)
            {
                IPropertyAssignmentStep propertyAssignmentStep = step as IPropertyAssignmentStep;
                if (propertyAssignmentStep == null)
                {
                    continue;
                }

                if (propertyAssignmentStep.Property == m_FlowHandler.FlowNominalProperty)
                {
                    isIsocratic   = true;
                    FlowRequested = (propertyAssignmentStep.Value as IDoublePropertyValue).Value.GetValueOrDefault();
                }
                else if (propertyAssignmentStep.Property == m_FlowHandler.ComponentProperties[1])
                {
                    isIsocratic      = true;
                    m_EluentPercentB = (propertyAssignmentStep.Value as IDoublePropertyValue).Value.GetValueOrDefault();
                }
                else if (propertyAssignmentStep.Property == m_FlowHandler.ComponentProperties[2])
                {
                    isIsocratic      = true;
                    m_EluentPercentC = (propertyAssignmentStep.Value as IDoublePropertyValue).Value.GetValueOrDefault();
                }
                else if (propertyAssignmentStep.Property == m_FlowHandler.ComponentProperties[3])
                {
                    isIsocratic      = true;
                    m_EluentPercentD = (propertyAssignmentStep.Value as IDoublePropertyValue).Value.GetValueOrDefault();
                }
            }

            if (isIsocratic)
            {
                Log.WriteLine(Id, "Isocratic - FlowRequested = " + FlowRequested.ToString());
                UpdateEluents();
                FlowNominal = FlowRequested;
                if (IsSimulated)
                {
                    Flow = FlowRequested;
                }
                return;
            }

            // In a real driver we would need to build some kind of time table and send it to the hardware.
            // In this example we create a list instead and write it to the audit trail.
            // Note that the property is not updated, as this would be done asynchronously during the run.
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Table of timed events:");
            foreach (IProgramStep step in args.RunContext.ProgramSteps)
            {
                IRampStep rampStep = step as IRampStep;
                if (rampStep == null)
                {
                    continue;
                }

                m_IsRamped = true;
                RetentionTime        duration   = rampStep.Duration;
                IDoublePropertyValue startValue = rampStep.StartValue as IDoublePropertyValue;
                IDoublePropertyValue endValue   = rampStep.EndValue as IDoublePropertyValue;

                const string sprt = "\t";
                sb.Append("Retention " + step.Retention.Minutes.ToString("F3") + sprt);
                sb.Append(startValue.Property.Owner.Name + "." + startValue.Property.Name + " = " + startValue.Value.Value.ToString("F3") + ", ");
                sb.Append(endValue.Property.Owner.Name + "." + endValue.Property.Name + " = " + endValue.Value.Value.ToString("F3") + ", ");
                sb.AppendLine("Duration = " + duration.Minutes.ToString("F3"));
            }

            if (m_IsRamped)
            {
                string text = "Table of timed events:" + Environment.NewLine + sb.ToString();
                Log.WriteLine(Id, "Gradient - " + text);

                // SendTimeTableCommand
                if (args.RunContext.IsManual)
                {
                    // SendStartCommand();
                }
            }
            else
            {
                string text = "Table of timed events: None";
                Log.WriteLine(Id, "Gradient - " + text);
            }
        }
示例#18
0
        void m_Device_OnPreflightBegin(PreflightEventArgs args)
        {
            String message = String.Format("Device.OnPreflightBegin({0}) called", args.RunContext);

            m_Device.AuditMessage(AuditLevel.Warning, message);
        }
示例#19
0
 private void OnDevicePreflightLatch(PreflightEventArgs args)
 {
     Log.WriteLine(Id, "ProgramTime.Minutes = " + args.RunContext.ProgramTime.Minutes.ToString());
 }