Beispiel #1
0
 private void OnDeviceSync(RuntimeEventArgs args)
 {
     Log.WriteLine(Id);
     if (m_IsFlowRequested)
     {
         Log.WriteLine(Id, "Send SendFlowCommand FlowRequested = " + FlowRequested.ToString());
         if (IsSimulated)
         {
             Flow = FlowRequested;
         }
         else
         {
             //SendFlowCommand(FlowRequested, m_EluentPercentA, m_EluentPercentB, m_EluentPercentC, m_EluentPercentD, m_PressureMin, m_PressureMax);
         }
         m_IsFlowRequested = false;
     }
 }
Beispiel #2
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);
            }
        }