Esempio n. 1
0
        public static bool SetFG_6Vrms()
        {
            double value = WaveFormGenerator.Flag33220 ? 0.00025 : 0.001;

            try
            {
                double 入力電圧初期値 = 3.020;//Vrms
                double OutBuff = 0;
                WaveFormGenerator.サイン波出力(50.0, 50.0, 入力電圧初期値, 0.0);
                OutBuff = 入力電圧初期値;
                //AGI33220A.サイン波出力(50.0, 50.0, 入力電圧初期値, 0.0);

                var Tm = new GeneralTimer(15000);
                Tm.Start();
                while (true)
                {
                    if (Tm.FlagTimeout || Flags.ClickStopButton)
                    {
                        return(false);
                    }
                    Hioki3239.GetAcVolt(Hioki3239.ACV_Range.R20V);
                    if (Hioki3239.VoltData >= 6.000 && Hioki3239.VoltData <= 6.005)
                    {
                        break;
                    }

                    if (Hioki3239.VoltData < 6.000)
                    {
                        OutBuff += value;
                        WaveFormGenerator.ChangeVoltage(OutBuff);
                        //AGI33220A.ChangeVoltage(入力電圧初期値 + (0.001 * cnt));
                    }
                    else if (Hioki3239.VoltData > 6.005)
                    {
                        OutBuff -= value;
                        WaveFormGenerator.ChangeVoltage(OutBuff);
                        //AGI33220A.ChangeVoltage(入力電圧初期値 - (0.001 * cnt));
                    }
                    Sleep(500);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public static bool SetFG_6_5Vrms()
        {
            try
            {
                double 入力電圧初期値 = 3.275;//Vrms
                WaveFormGenerator.サイン波出力(50.0, 50.0, 入力電圧初期値, 0.0);
                double buff = 入力電圧初期値;
                Tm.Stop();
                Tm.Interval = 18000;
                FlagTimer   = true;
                Tm.Start();
                while (true)
                {
                    if (!FlagTimer || Flags.ClickStopButton)
                    {
                        return(false);
                    }
                    Application.DoEvents();
                    Hioki3239.GetAcVolt(Hioki3239.ACV_Range.R20V);
                    if (Hioki3239.VoltData >= 6.497 && Hioki3239.VoltData <= 6.503)
                    {
                        break;
                    }

                    if (Hioki3239.VoltData < 6.497)
                    {
                        buff += 0.002;
                        WaveFormGenerator.ChangeVoltage(buff);
                    }
                    else if (Hioki3239.VoltData > 6.503)
                    {
                        buff -= 0.002;
                        WaveFormGenerator.ChangeVoltage(buff);
                    }
                    Sleep(200);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }