private void manualSettings_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex == comboBox1.Items.Count - 1)
     {
         lg = new Login();
         if (lg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             setupWindow = new Setup();
             if (setupWindow.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 manualsettings = setupWindow.getSettings();
             }
             else
             {
                 comboBox1.SelectedIndex = 0;
             }
         }
     }
 }
Example #2
0
        public BrazeSettings getSettings()
        {
            BrazeSettings manualsettings = new BrazeSettings();

            manualsettings.brazeTemp = (double)brazetemp.Value;
            manualsettings.brazeTime = (int)brazetime.Value;
            manualsettings.syncL1    = (double)sync1.Value;
            manualsettings.syncL2    = (double)sync2.Value;
            manualsettings.pressure1 = (double)pressure1.Value;
            manualsettings.pressure2 = (double)pressure2.Value;
            manualsettings.pressure3 = (double)pressure3.Value;

            if (speed1.SelectedIndex == speed1.Items.Count - 1)
            {
                manualsettings.speedStartL1 = -1;
            }
            else
            {
                manualsettings.speedStartL1 = (speed1.SelectedIndex + 1) / 2;
            }

            if (speed2.SelectedIndex == speed2.Items.Count - 1)
            {
                manualsettings.speedL1L2 = -1;
            }
            else
            {
                manualsettings.speedL1L2 = (speed2.SelectedIndex + 1) / 2;
            }

            if (speed3.SelectedIndex == speed3.Items.Count - 1)
            {
                manualsettings.speedL2Braze = -1;
            }
            else
            {
                manualsettings.speedL2Braze = (speed3.SelectedIndex + 1) / 2;
            }

            return(manualsettings);
        }
        public BrazeSettings getSettings()
        {
            BrazeSettings manualsettings = new BrazeSettings();
            manualsettings.brazeTemp = (double)brazetemp.Value;
            manualsettings.brazeTime = (int)brazetime.Value;
            manualsettings.syncL1 = (double)sync1.Value;
            manualsettings.syncL2 = (double)sync2.Value;
            manualsettings.pressure1 = (double)pressure1.Value;
            manualsettings.pressure2 = (double)pressure2.Value;
            manualsettings.pressure3 = (double)pressure3.Value;

            if (speed1.SelectedIndex == speed1.Items.Count - 1)
            {
                manualsettings.speedStartL1 = -1;
            }
            else
            {
                manualsettings.speedStartL1 = (speed1.SelectedIndex + 1) / 2;
            }

            if (speed2.SelectedIndex == speed2.Items.Count - 1)
            {
                manualsettings.speedL1L2 = -1;
            }
            else
            {
                manualsettings.speedL1L2 = (speed2.SelectedIndex + 1) / 2;
            }

            if (speed3.SelectedIndex == speed3.Items.Count - 1)
            {
                manualsettings.speedL2Braze = -1;
            }
            else
            {
                manualsettings.speedL2Braze = (speed3.SelectedIndex + 1) / 2;
            }

            return manualsettings;
        }
 private void manualSettings_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex == comboBox1.Items.Count - 1)
     {
         lg = new Login();
         if (lg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             setupWindow = new Setup();
             if (setupWindow.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 manualsettings = setupWindow.getSettings();
             }
             else
             {
                 comboBox1.SelectedIndex = 0;
             }
         }
     }
 }
        private bool heatingUp(BrazeSettings brazeSettings)
        {
            processWorker.ReportProgress((int)ReportType.SetPhase, Phase.Heating);
            bool smallopened = false;

            processWorker.ReportProgress((int)ReportType.SetStatus, "Heating up to " + brazeSettings.brazeTemp + " °C.");
            //start  heater for section1,section2 and section3
            processWorker.ReportProgress((int)ReportType.HeaterPowerSignal, "on");

            // syncronize the temperatures

            double gTemp = 0;

            if (brazeSettings.speedStartL1 == -1)
            {
                gTemp = brazeSettings.syncL1;
                processWorker.ReportProgress((int)ReportType.SetGoalTemp, brazeSettings.syncL1);

            }
            else
            {

                gTemp = (tempSection[0] + tempSection[1] + tempSection[2]) / 3;
                processWorker.ReportProgress((int)ReportType.SetGoalTemp, gTemp);
            }

            while (paused || stoppedHeating || !(reachedLevel(brazeSettings.syncL1) && targetTemp >= brazeSettings.syncL1))
            {
                if (gTemp < brazeSettings.syncL1 && brazeSettings.speedStartL1 != -1)
                {
                    gTemp = gTemp + (brazeSettings.speedStartL1 / 60);
                    processWorker.ReportProgress((int)ReportType.SetGoalTemp, gTemp);
                }
                if (tempSection[1] > 800 && !smallopened)
                {
                    //open smallNitrogenValve
                    processWorker.ReportProgress((int)ReportType.SmallN2ValveSignal, "on");
                    smallopened = true;
                }
                if (stoppedHeating)
                { return false; }
                Thread.Sleep(1000);
            }
            if (brazeSettings.speedL1L2 == -1)
            {
                processWorker.ReportProgress((int)ReportType.SetGoalTemp, brazeSettings.syncL2);
            }
            else
            {
                gTemp = brazeSettings.syncL1;
                processWorker.ReportProgress((int)ReportType.SetGoalTemp, brazeSettings.syncL1);
            }

            while (paused || stoppedHeating || !(reachedLevel(brazeSettings.syncL2) && targetTemp >= brazeSettings.syncL2))
            {
                if (gTemp < brazeSettings.syncL2 && brazeSettings.speedL1L2 != -1)
                {
                    gTemp = gTemp + (brazeSettings.speedL1L2 / 60);
                    processWorker.ReportProgress((int)ReportType.SetGoalTemp, gTemp);
                }
                if (tempSection[1] > 800 && !smallopened)
                {
                    //open smallNitrogenValve
                    processWorker.ReportProgress((int)ReportType.SmallN2ValveSignal, "on");
                    smallopened = true;
                }
                if (stoppedHeating)
                { return false; }
                Thread.Sleep(1000);
            }
            if (brazeSettings.speedL2Braze == -1)
            {
                processWorker.ReportProgress((int)ReportType.SetGoalTemp, brazeSettings.brazeTemp);
            }
            else
            {
                gTemp = brazeSettings.syncL2;
                processWorker.ReportProgress((int)ReportType.SetGoalTemp, brazeSettings.syncL2);
            }

            while (paused || stoppedHeating || !(reachedLevel(brazeSettings.brazeTemp) && targetTemp >= brazeSettings.brazeTemp))
            {
                if (gTemp < brazeSettings.brazeTemp && brazeSettings.speedL2Braze != -1)
                {
                    gTemp = gTemp + (brazeSettings.speedL2Braze / 60);
                    processWorker.ReportProgress((int)ReportType.SetGoalTemp, gTemp);
                }
                if (tempSection[1] > 800 && !smallopened)
                {
                    //open smallNitrogenValve
                    processWorker.ReportProgress((int)ReportType.SmallN2ValveSignal, "on");
                    smallopened = true;
                }
                if (stoppedHeating)
                { return false; }
                Thread.Sleep(1000);
            }

            gTemp = brazeSettings.brazeTemp;
            processWorker.ReportProgress((int)ReportType.SetGoalTemp, brazeSettings.brazeTemp);

            return true;
        }
        private bool cooling(BrazeSettings brazeSettings)
        {
            processWorker.ReportProgress((int)ReportType.SetPhase, Phase.Cooling);
            //close heater for section1,section2 and section3
            processWorker.ReportProgress((int)ReportType.SetStatus, "Brazing finished, self cooling.");
            processWorker.ReportProgress((int)ReportType.HeaterPowerSignal, "off");

            while ((tempSection[0] > 1020 || tempSection[1] > 1020 || tempSection[2] > 1020) || paused || stoppedCooling)
            {
                if (stoppedCooling)
                {
                    return false;
                }
                Thread.Sleep(1000);
            }

            processWorker.ReportProgress((int)ReportType.SetStatus, "Active cooling.");
            //Open large nitrogen valve
            processWorker.ReportProgress((int)ReportType.LargeN2ValveSignal, "on");

            processWorker.ReportProgress((int)ReportType.SmallN2ValveSignal, "off");
            //Close vacuum valve
            processWorker.ReportProgress((int)ReportType.VacuumValveSignal, "off");

            while (normalPressure <= 0.5)//Wait until Pn  > 0.5 bar
            {

                Thread.Sleep(100);
            }

            //Close roots pump
            processWorker.ReportProgress((int)ReportType.BoosterPumpSignal, "off");

            while (normalPressure <= 1 || paused || stoppedCooling)//Wait until Pn >1 bar
            {
                if (stoppedCooling)
                {
                    return false;
                }
                Thread.Sleep(100);
            }
            // Start cooling fans
            processWorker.ReportProgress((int)ReportType.CoolingFanSignal, "on");
            //Close vacuum pump
            processWorker.ReportProgress((int)ReportType.VacuumPumpSignal, "off");

            while (normalPressure <= 1.1 || paused || stoppedCooling)//Wait until Pn>  1.1bar
            {
                if (stoppedCooling)
                {
                    return false;
                }
                Thread.Sleep(100);
            }
            //Close large nitrogen valve
            processWorker.ReportProgress((int)ReportType.LargeN2ValveSignal, "off");

            while ((tempSection[0] > 930 && tempSection[1] > 930 && tempSection[2] > 930) || paused || stoppedCooling)   //Wait until temps < 930C
            {
                if (stoppedCooling)
                {
                    return false;
                }
                if (normalPressure > brazeSettings.pressure1)
                {
                    //Close large nitrogen valve
                    processWorker.ReportProgress((int)ReportType.LargeN2ValveSignal, "off");
                }
                else
                {
                    //open large nitrogen valve
                    processWorker.ReportProgress((int)ReportType.LargeN2ValveSignal, "on");
                }
                Thread.Sleep(100);
            }

            while ((tempSection[0] > 800 && tempSection[1] > 800 && tempSection[2] > 800) || paused || stoppedCooling)   //Wait until temps < 800C
            {
                if (stoppedCooling)
                {
                    return false;
                }
                if (normalPressure > brazeSettings.pressure2)
                {
                    //Close large nitrogen valve
                    processWorker.ReportProgress((int)ReportType.LargeN2ValveSignal, "off");
                }
                else
                {
                    //Open large nitrogen valve
                    processWorker.ReportProgress((int)ReportType.LargeN2ValveSignal, "on");
                }
                Thread.Sleep(100);
            }

            while (tempSection[0] > 150 || tempSection[1] > 150 || tempSection[2] > 150 || paused || stoppedCooling)   //Wait until temps < 150C
            {
                if (stoppedCooling)
                {
                    return false;
                }
                if (normalPressure > brazeSettings.pressure3)
                {
                    //Open large nitrogen valve
                    processWorker.ReportProgress((int)ReportType.LargeN2ValveSignal, "off");
                }
                else
                {
                    //Close large nitrogen valve
                    processWorker.ReportProgress((int)ReportType.LargeN2ValveSignal, "on");
                }
                Thread.Sleep(1000);
            }
            return true;
        }
        private void braze(BrazeSettings brazeSettings)
        {
            processWorker.ReportProgress((int)ReportType.SetBrazeStart);
            //Hold brazing temp for x minute
            processWorker.ReportProgress((int)ReportType.SetStatus, "Holding brazing temperature for " + brazeSettings.brazeTime + " minutes");

            for (int j = 0; j < brazeSettings.brazeTime * 60 || paused || stoppedHeating; j++)
            {
                if (stoppedHeating)
                { return; }

                Thread.Sleep(1000);

            }
        }
 internal void setProcessSettings(BrazeSettings csettings)
 {
     if (!processWorker.IsBusy)
     {
         beginTime = DateTime.Now;
         tempC = new TemperatureController();
         processWorker.RunWorkerAsync(csettings);
         brazeTemp = csettings.brazeTemp;
         brazeTime = csettings.brazeTime;
         liveUploader.startTime = DateTime.Now.ToString("HH:mm:ss");
         liveUploader.mode = csettings.modeName;
         liveUploader.status = "Running";
     }
 }