Ejemplo n.º 1
0
        public void SetHeatingElementStatus(OvenChanEnum oven_element,
            OvenHeatOnOffEnum element_on_or_off)
        {
            switch (oven_element)
            {
                case OvenChanEnum.AllOff:
                case OvenChanEnum.OvenOff:
                    outer_status = false;
                    sample_zone_status = false;
                    inner_status = false;
                    break;

                case OvenChanEnum.Inner:
                    if (element_on_or_off == OvenHeatOnOffEnum.On)
                    {
                        inner_status = true;
                    }
                    else
                    {
                        inner_status = false;
                    }
                    break;

                case OvenChanEnum.Outer:
                    if (element_on_or_off == OvenHeatOnOffEnum.On)
                    {
                        outer_status = true;
                    }
                    else
                    {
                        outer_status = false;
                    }
                    break;

                case OvenChanEnum.SampleZone:
                    if (element_on_or_off == OvenHeatOnOffEnum.On)
                    {
                        sample_zone_status = true;
                    }
                    else
                    {
                        sample_zone_status = false;
                    }
                    break;

                case OvenChanEnum.OvenOn:
                    outer_status = true;
                    sample_zone_status = true;
                    inner_status = true;
                    break;

                default:
                    //exit function
                    return;
            }

            if (outer_status)
                SetOuterIndicatorToOn();
            else
                SetOuterIndicatorToOff();

            if (inner_status)
                SetInnerIndicatorToOn();
            else
                SetInnerIndicatorToOff();

            if (sample_zone_status)
                SetSampleZoneIndicatorToOn();
            else
                SetSampleZoneIndicatorToOff();
        }
Ejemplo n.º 2
0
        private void SetOvenChannelOutput(OvenChanEnum channel, OvenHeatOnOffEnum on_or_off)
        {
            MccDaq.ErrorInfo RetVal = new ErrorInfo();

            switch (channel)
            {
                case OvenChanEnum.OvenOn:
                    for (int i = 0; i < 3; i++)
                    {
                        if ((i == inner_zone_heater_index &&
                             inner_zone_heater_disabled) ||
                            (i == sample_zone_heater_index &&
                             sample_zone_heater_disabled) ||
                            (i == outer_zone_heater_index &&
                             outer_zone_heater_disabled))
                        {
                            //Toggle heating element off
                            //Heating element has been programmatically disabled
                            RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                                 i,
                                                 DigitalLogicState.Low);
                            IsError(this, RetVal, true);
                        }
                        else
                        {
                            //Toggle heating element on
                            RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                                 i,
                                                 DigitalLogicState.High);
                            IsError(this, RetVal, true);
                        }
                    }
                    break;

                case OvenChanEnum.OvenOff:
                    for (int i = 0; i < 3; i++)
                    {
                        RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                             i,
                                             DigitalLogicState.Low);
                        IsError(this, RetVal, true);
                    }
                    break;

                case OvenChanEnum.AllOff:
                    for (int i = 0; i < 3; i++)
                    {
                        RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                             i,
                                             DigitalLogicState.Low);
                        IsError(this, RetVal, true);
                    }
                    break;

                case OvenChanEnum.Inner:

                    if (on_or_off == OvenHeatOnOffEnum.On &&
                        !inner_zone_heater_disabled)
                    {
                        RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                             inner_zone_heater_index,
                                             DigitalLogicState.High);
                    }
                    else
                    {
                        RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                             inner_zone_heater_index,
                                             DigitalLogicState.Low);
                    }

                    IsError(this, RetVal, true);
                    break;

                case OvenChanEnum.SampleZone:

                    if (on_or_off == OvenHeatOnOffEnum.On &&
                        !sample_zone_heater_disabled)
                    {
                        RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                             sample_zone_heater_index,
                                             DigitalLogicState.High);
                    }
                    else
                    {
                        RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                             sample_zone_heater_index,
                                             DigitalLogicState.Low);
                    }

                    IsError(this, RetVal, true);
                    break;

                case OvenChanEnum.Outer:

                    if (on_or_off == OvenHeatOnOffEnum.On &&
                        !outer_zone_heater_disabled)
                    {
                        RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                             outer_zone_heater_index,
                                             DigitalLogicState.High);
                    }
                    else
                    {
                        RetVal = oven_board.DBitOut(DigitalPortType.AuxPort,
                                             outer_zone_heater_index,
                                             DigitalLogicState.Low);
                    }

                    IsError(this, RetVal, true);
                    break;

                default:
                    RetVal = new ErrorInfo(1);
                    MessageBox.Show(
                        "Set Oven Channel Output error -- invalid Oven Channel Output State input.",
                        "   " + "ERROR!");
                    break;
            }

            RetVal = oven_board.DConfigBit(DigitalPortType.AuxPort, 0,
                DigitalPortDirection.DigitalOut);

            if (IsError(this, RetVal, true) == ErrorCodeEnum.NoError)
            {
                oven_status = channel;
                SetHeatingElementStatus(channel, on_or_off);
            }
        }