Ejemplo n.º 1
0
        public void initFunction(object panel, SourcePluginInterface.InterfaceSourcePlugin source, addText callback, runCheckFP runchkCB, functionDoneFP checkDoneCB, string configDir)
        {
            Panel pPanel = (Panel) panel;
            addTextCallback = callback;
            curSource = source;
            runCheckCB = runchkCB;
            checkDoneCallback = checkDoneCB;
            confDir = configDir;
            DeviceInformation devInfo = curSource.GetDeviceInformation();

            float minSpg, sdlavSpg;
            int output, tBetween;
            bool checkRun, checkStopFailed;
            bool checkSDLAVWaitTimeout;
            int testToRunIndex;
            /**
             * load settings
             */
            try
            {
                // Create Settings Table
                DataTable mySettings = new DataTable("SettingsPluginRamp61131-2");
                mySettings.ReadXml(confDir + Path.DirectorySeparatorChar + "config_plugin_ramp61131-2.xml");

                minSpg = (float)Convert.ToDecimal(mySettings.Rows[0]["VoltageStart"].ToString());
                sdlavSpg = (float)Convert.ToDecimal(mySettings.Rows[0]["VoltageStop"].ToString());
                output = Convert.ToInt32(mySettings.Rows[0]["Output"].ToString(), 10);
                checkRun = Convert.ToBoolean(mySettings.Rows[0]["RunCheck"].ToString());
                checkStopFailed = Convert.ToBoolean(mySettings.Rows[0]["StopOnFailedCheck"].ToString());
                checkSDLAVWaitTimeout = Convert.ToBoolean(mySettings.Rows[0]["CheckSDLAVWaitTimeout"].ToString());
                tBetween = Convert.ToInt32(mySettings.Rows[0]["DelayBetween"].ToString(), 10);
                testToRunIndex = Convert.ToInt32(mySettings.Rows[0]["TestToRunIndex"].ToString(), 10);
            }
            catch
            {
                minSpg = (float) 0.0;
                sdlavSpg = (float)24.0;
                output = 1;
                checkRun = false;
                checkStopFailed = false;
                tBetween = 5000;
                checkSDLAVWaitTimeout = true;
                testToRunIndex = 3;
            }

            /**
             * create for entries
             */
            Label lbl = new Label();
            lbl.Text = "Ue min [V]";
            lbl.Top = 10;
            lbl.Left = 5;
            lbl.Width = 85;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudVemin = new NumericUpDown();
            nudVemin.Left   = 195;
            nudVemin.Top    =  8;
            nudVemin.Width  = 74;
            nudVemin.Height = 20;
            nudVemin.DecimalPlaces = 2;
            nudVemin.Minimum = (decimal) devInfo.voltageMin;
            nudVemin.Maximum = (decimal) devInfo.voltageMax;
            if(minSpg >= devInfo.voltageMin && minSpg <= devInfo.voltageMax)
                nudVemin.Value = (decimal) minSpg;
            else
                nudVemin.Value = (decimal)devInfo.voltageMin;
            pPanel.Controls.Add(nudVemin);

            lbl = new Label();
            lbl.Text = "0.9 SDL AV[V]";
            lbl.Top = 36;
            lbl.Left = 5;
            lbl.Width = 80;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudSDLAV = new NumericUpDown();
            nudSDLAV.Left = 195;
            nudSDLAV.Top = 34;
            nudSDLAV.Width = 74;
            nudSDLAV.Height = 20;
            nudSDLAV.DecimalPlaces = 2;
            nudSDLAV.Minimum = (decimal)devInfo.voltageMin;
            nudSDLAV.Maximum = (decimal)devInfo.voltageMax;
            if (sdlavSpg >= devInfo.voltageMin && sdlavSpg <= devInfo.voltageMax)
                nudSDLAV.Value = (decimal)sdlavSpg;
            else
                nudSDLAV.Value = (decimal)devInfo.voltageMax;
            pPanel.Controls.Add(nudSDLAV);

            lbl = new Label();
            lbl.Text = "Time between tests [ms]";
            lbl.Top = 62;
            lbl.Left = 5;
            lbl.Width = 61;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudtBetweenTests = new NumericUpDown();
            nudtBetweenTests.Left = 195;
            nudtBetweenTests.Top = 60;
            nudtBetweenTests.Width = 74;
            nudtBetweenTests.Height = 20;
            nudtBetweenTests.Minimum = 1000;//curSource.GetMinimalUpdateTimeMS();
            nudtBetweenTests.Maximum = 10000;
            if (tBetween >= nudtBetweenTests.Minimum && tBetween <= nudtBetweenTests.Maximum)
                nudtBetweenTests.Value = tBetween;
            else
                nudtBetweenTests.Value = nudtBetweenTests.Minimum;
            pPanel.Controls.Add(nudtBetweenTests);

            lbl = new Label();
            lbl.Text = "Ausgang";
            lbl.Top = 88;
            lbl.Left = 5;
            lbl.Width = 80;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudOutput = new NumericUpDown();
            nudOutput.Left = 195;
            nudOutput.Top = 86;
            nudOutput.Width = 74;
            nudOutput.Height = 20;
            nudOutput.Minimum = 1;
            nudOutput.Maximum = curSource.GetOutputCount();
            if (output >= nudOutput.Minimum && output <= nudOutput.Maximum)
                nudOutput.Value = output;
            else
                nudOutput.Value = nudOutput.Minimum;
            pPanel.Controls.Add(nudOutput);

            lbl = new Label();
            lbl.Text = "Test to run";
            lbl.Top = 114;
            lbl.Left = 5;
            lbl.Width = 80;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            cbTestToRun = new ComboBox();
            cbTestToRun.Left = 195;
            cbTestToRun.Top = 112;
            cbTestToRun.Width = 100;
            cbTestToRun.Height = 20;
            cbTestToRun.Items.Add("6.4.2.1");
            cbTestToRun.Items.Add("6.4.2.2 (fast)");
            cbTestToRun.Items.Add("6.4.2.2 (slow)");
            cbTestToRun.Items.Add("all");
            cbTestToRun.SelectedIndex = testToRunIndex;
            pPanel.Controls.Add(cbTestToRun);

            cbCheckSDLAVWaitTimeout = new CheckBox();
            cbCheckSDLAVWaitTimeout.Left = 5;
            cbCheckSDLAVWaitTimeout.Top = 140;
            cbCheckSDLAVWaitTimeout.Width = 240;
            cbCheckSDLAVWaitTimeout.Text = "Check SDLAV - Wait for timeout";
            cbCheckSDLAVWaitTimeout.Checked = checkSDLAVWaitTimeout;
            pPanel.Controls.Add(cbCheckSDLAVWaitTimeout);

            cbTestRun = new CheckBox();
            cbTestRun.Left = 5;
            cbTestRun.Top = 166;
            cbTestRun.Width = 180;
            cbTestRun.Text = "Run Checks";
            cbTestRun.Checked = checkRun;
            pPanel.Controls.Add(cbTestRun);

            cbTestStopWhenFailed = new CheckBox();
            cbTestStopWhenFailed.Left = 195;
            cbTestStopWhenFailed.Top = 166;
            cbTestStopWhenFailed.Width = 120;
            cbTestStopWhenFailed.Text = "Stop on error";
            cbTestStopWhenFailed.Checked = checkStopFailed;
            pPanel.Controls.Add(cbTestStopWhenFailed);

            btnStart = new Button();
            btnStart.Left = 5;
            btnStart.Top = 192;
            btnStart.Width = 75;
            btnStart.Height = 23;
            btnStart.Text = "Start";
            btnStart.Click += new System.EventHandler(btnStart_Click);
            pPanel.Controls.Add(btnStart);

            btnStop = new Button();
            btnStop.Left = 90;
            btnStop.Top = 192;
            btnStop.Width = 75;
            btnStop.Height = 23;
            btnStop.Text = "Stop";
            btnStop.Enabled = false;
            btnStop.Click += new System.EventHandler(btnStop_Click);
            pPanel.Controls.Add(btnStop);

            lblStatus = new Label();
            lblStatus.Text = "Status:";
            lblStatus.Top = 218;
            lblStatus.Left = 5;
            lblStatus.Width = 280;
            lblStatus.Height = 13;
            pPanel.Controls.Add(lblStatus);

            lblVoltage = new Label();
            lblVoltage.Text = "Voltage:";
            lblVoltage.Top = 244;
            lblVoltage.Left = 5;
            lblVoltage.Width = 280;
            lblVoltage.Height = 13;
            pPanel.Controls.Add(lblVoltage);
        }
Ejemplo n.º 2
0
        public void initFunction(object panel, SourcePluginInterface.InterfaceSourcePlugin source, addText callback, runCheckFP runchkCB, functionDoneFP checkDoneCB, string configDir)
        {
            Panel pPanel = (Panel) panel;
            addTextCallback = callback;
            curSource = source;
            runCheckCB = runchkCB;
            checkDoneCallback = checkDoneCB;
            confDir = configDir;
            DeviceInformation devInfo = curSource.GetDeviceInformation();

            float startSpg, stopSpg, rampSpg;
            int tRamp, tDelayOn, tDelayOff, counts, output;
            bool checkRun, checkStopFailed;
            /**
             * load settings
             */
            try
            {
                // Create Settings Table
                DataTable mySettings = new DataTable("SettingsPluginRampSawTooth");
                mySettings.ReadXml(confDir + Path.DirectorySeparatorChar + "config_plugin_rampsawtooth.xml");

                startSpg = (float)Convert.ToDecimal(mySettings.Rows[0]["VoltageStart"].ToString());
                stopSpg = (float)Convert.ToDecimal(mySettings.Rows[0]["VoltageStop"].ToString());
                rampSpg = (float)Convert.ToDecimal(mySettings.Rows[0]["VoltageRampDelta"].ToString());
                tRamp = Convert.ToInt32(mySettings.Rows[0]["DelayRamp"].ToString(), 10);
                tDelayOn = Convert.ToInt32(mySettings.Rows[0]["DelayOn"].ToString(), 10);
                tDelayOff = Convert.ToInt32(mySettings.Rows[0]["DelayOff"].ToString(), 10);
                counts = Convert.ToInt32(mySettings.Rows[0]["Counts"].ToString(), 10);
                output = Convert.ToInt32(mySettings.Rows[0]["Output"].ToString(), 10);
                checkRun = Convert.ToBoolean(mySettings.Rows[0]["RunCheck"].ToString());
                checkStopFailed = Convert.ToBoolean(mySettings.Rows[0]["StopOnFailedCheck"].ToString());
            }
            catch
            {
                startSpg = (float) 0.0;
                stopSpg = (float)24.0;
                rampSpg = (float)0.05;
                tRamp = 100;
                tDelayOn = 10000;
                tDelayOff = 10000;
                counts = 50;
                output = 1;
                checkRun = false;
                checkStopFailed = false;
            }

            /**
             * create for entries
             */
            Label lbl = new Label();
            lbl.Text = "Start-Spg [V]";
            lbl.Top = 10;
            lbl.Left = 5;
            lbl.Width = 85;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudVStart = new NumericUpDown();
            nudVStart.Left   = 95;
            nudVStart.Top    =  8;
            nudVStart.Width  = 74;
            nudVStart.Height = 20;
            nudVStart.DecimalPlaces = 2;
            nudVStart.Minimum = (decimal) devInfo.voltageMin;
            nudVStart.Maximum = (decimal) devInfo.voltageMax;
            if(startSpg >= devInfo.voltageMin && startSpg <= devInfo.voltageMax)
                nudVStart.Value = (decimal) startSpg;
            else
                nudVStart.Value = (decimal)devInfo.voltageMin;
            pPanel.Controls.Add(nudVStart);

            lbl = new Label();
            lbl.Text = "Stop-Spg [V]";
            lbl.Top = 10;
            lbl.Left = 182;
            lbl.Width = 80;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudVStop = new NumericUpDown();
            nudVStop.Left = 263;
            nudVStop.Top = 8;
            nudVStop.Width = 74;
            nudVStop.Height = 20;
            nudVStop.DecimalPlaces = 2;
            nudVStop.Minimum = (decimal)devInfo.voltageMin;
            nudVStop.Maximum = (decimal)devInfo.voltageMax;
            if (stopSpg >= devInfo.voltageMin && stopSpg <= devInfo.voltageMax)
                nudVStop.Value = (decimal)stopSpg;
            else
                nudVStop.Value = (decimal)devInfo.voltageMax;
            pPanel.Controls.Add(nudVStop);

            lbl = new Label();
            lbl.Text = "tRamp[ms]";
            lbl.Top = 36;
            lbl.Left = 5;
            lbl.Width = 61;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudtRamp = new NumericUpDown();
            nudtRamp.Left = 95;
            nudtRamp.Top = 34;
            nudtRamp.Width = 74;
            nudtRamp.Height = 20;
            nudtRamp.Minimum = curSource.GetMinimalUpdateTimeMS();
            nudtRamp.Maximum = 99999;
            if (tRamp >= nudtRamp.Minimum && tRamp <= nudtRamp.Maximum)
                nudtRamp.Value = tRamp;
            else
                nudtRamp.Value = nudtRamp.Minimum;
            pPanel.Controls.Add(nudtRamp);

            lbl = new Label();
            lbl.Text = "URamp [V]";
            lbl.Top = 36;
            lbl.Left = 182;
            lbl.Width = 67;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudVRamp = new NumericUpDown();
            nudVRamp.Left = 263;
            nudVRamp.Top = 34;
            nudVRamp.Width = 74;
            nudVRamp.Height = 20;
            nudVRamp.Minimum = (decimal) 0.01;
            nudVRamp.Increment = (decimal)0.1;
            nudVRamp.DecimalPlaces = 2;
            nudVRamp.Maximum = 200;
            if ((decimal)rampSpg >= nudVRamp.Minimum && (decimal) rampSpg <= nudVRamp.Maximum)
                nudVRamp.Value = (decimal)rampSpg;
            else
                nudVRamp.Value = nudVRamp.Minimum;

            pPanel.Controls.Add(nudVRamp);

            lbl = new Label();
            lbl.Text = "tDelayOn[ms]";
            lbl.Top = 62;
            lbl.Left = 5;
            lbl.Width = 70;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudDelayOn = new NumericUpDown();
            nudDelayOn.Left = 95;
            nudDelayOn.Top = 60;
            nudDelayOn.Width = 74;
            nudDelayOn.Height = 20;
            nudDelayOn.Minimum = curSource.GetMinimalUpdateTimeMS();
            nudDelayOn.Maximum = 999999;
            if (tDelayOn >= nudDelayOn.Minimum && tDelayOn <= nudDelayOn.Maximum)
                nudDelayOn.Value = tDelayOn;
            else
                nudDelayOn.Value = nudDelayOn.Minimum;

            pPanel.Controls.Add(nudDelayOn);

            lbl = new Label();
            lbl.Text = "tDelayOff[ms]";
            lbl.Top = 62;
            lbl.Left = 182;
            lbl.Width = 80;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudDelayOff = new NumericUpDown();
            nudDelayOff.Left = 263;
            nudDelayOff.Top = 60;
            nudDelayOff.Width = 74;
            nudDelayOff.Height = 20;
            nudDelayOff.Minimum = curSource.GetMinimalUpdateTimeMS();
            nudDelayOff.Maximum = 999999;
            if (tDelayOff >= nudDelayOff.Minimum && tDelayOff <= nudDelayOff.Maximum)
                nudDelayOff.Value = tDelayOff;
            else
                nudDelayOff.Value = nudDelayOff.Minimum;
            pPanel.Controls.Add(nudDelayOff);

            lbl = new Label();
            lbl.Text = "Wiederholungen";
            lbl.Top = 88;
            lbl.Left = 5;
            lbl.Width = 85;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudCounts = new NumericUpDown();
            nudCounts.Left = 95;
            nudCounts.Top = 86;
            nudCounts.Width = 74;
            nudCounts.Height = 20;
            nudCounts.Minimum = 1;
            nudCounts.Maximum = 100000;
            if (counts >= nudCounts.Minimum && counts <= nudCounts.Maximum)
                nudCounts.Value = counts;
            else
                nudCounts.Value = nudCounts.Minimum;
            pPanel.Controls.Add(nudCounts);

            lbl = new Label();
            lbl.Text = "Ausgang";
            lbl.Top = 88;
            lbl.Left = 182;
            lbl.Width = 80;
            lbl.Height = 13;
            pPanel.Controls.Add(lbl);

            nudOutput = new NumericUpDown();
            nudOutput.Left = 263;
            nudOutput.Top = 86;
            nudOutput.Width = 74;
            nudOutput.Height = 20;
            nudOutput.Minimum = 1;
            nudOutput.Maximum = curSource.GetOutputCount();
            if (output >= nudOutput.Minimum && output <= nudOutput.Maximum)
                nudOutput.Value = output;
            else
                nudOutput.Value = nudOutput.Minimum;
            pPanel.Controls.Add(nudOutput);

            cbTestRun = new CheckBox();
            cbTestRun.Left = 5;
            cbTestRun.Top = 114;
            cbTestRun.Text = "Überprüfung durchführen";
            cbTestRun.Checked = checkRun;
            pPanel.Controls.Add(cbTestRun);

            cbTestStopWhenFailed = new CheckBox();
            cbTestStopWhenFailed.Left = 182;
            cbTestStopWhenFailed.Top = 114;
            cbTestStopWhenFailed.Width = 120;
            cbTestStopWhenFailed.Text = "bei Fehler anhalten";
            cbTestStopWhenFailed.Checked = checkStopFailed;
            pPanel.Controls.Add(cbTestStopWhenFailed);

            btnStart = new Button();
            btnStart.Left = 5;
            btnStart.Top = 140;
            btnStart.Width = 75;
            btnStart.Height = 23;
            btnStart.Text = "Start";
            btnStart.Click += new System.EventHandler(btnStart_Click);
            pPanel.Controls.Add(btnStart);

            btnStop = new Button();
            btnStop.Left = 90;
            btnStop.Top = 140;
            btnStop.Width = 75;
            btnStop.Height = 23;
            btnStop.Text = "Stop";
            btnStop.Enabled = false;
            btnStop.Click += new System.EventHandler(btnStop_Click);
            pPanel.Controls.Add(btnStop);

            lblStatus = new Label();
            lblStatus.Text = "Status:";
            lblStatus.Top = 166;
            lblStatus.Left = 5;
            lblStatus.Width = 280;
            lblStatus.Height = 13;
            pPanel.Controls.Add(lblStatus);

            lblVoltage = new Label();
            lblVoltage.Text = "Voltage:";
            lblVoltage.Top = 192;
            lblVoltage.Left = 5;
            lblVoltage.Width = 280;
            lblVoltage.Height = 13;
            pPanel.Controls.Add(lblVoltage);
        }