/// <summary> /// calculate the aparant current, Iacs current measured by the pcu components /// </summary> /// <param name="pcureal"></param> /// <param name="powermeter"></param> /// <param name="reactive"></param> /// <param name="chartarea"></param> /// <param name="FS"></param> private void plot_apparant_current(string pcureal, string powermeter, string reactive, string chartarea, float persent_fail_margin, List <float> filter_mask, List <float> maskVdccnf) { //clear series and add the series //chart3.Series.Clear(); //get the powermeter float values List <float> PM = getfloatlist(powermeter); //Calculate tthe aparant ac current list from the pcu List <float> appartcurrent = new List <float> (Calculate.Get_pcu_apparantcurrent(getfloatlist(reactive), getfloatlist(pcureal))); //**************************Setup chart4******************************************************** // setup_chart4axes(chart4); addlist_series_tochart(chart4, new List <string>() { pcureal, "Accumulate" }); setupseriesline(chart4.Series[pcureal]); //setup the color and the line type plot chart4.Series[pcureal].Points.AddXY(0, 0); //Add the first dot to the line //******************************End chart 4 setup*********************************************** //**************************Setup chart3******************************************************** //setup series names to be added to chart3 List <string> series = new List <string> { powermeter, "pcuIacs" }; addlist_series_tochart(chart3, new List <string> { powermeter, "pcuIacs" }); //Get the bool fail list for specific margins (The ones are percentage 1) // List<bool> accuracyfaillist = new List<bool>(Calculate.Faillist(appartcurrent, PM, 1, FS, 1)); List <bool> accuracyfaillist = new List <bool>(Calculate.Pesentage_faillist(appartcurrent, PM, persent_fail_margin)); chart3.Series[powermeter].ChartArea = chartarea; chart3.Series["pcuIacs"].ChartArea = chartarea; setupseriescross(chart3.Series["pcuIacs"]); setupseriescircle(chart3.Series[powermeter]); for (int i = 0; i < PM.Count; i++) { //ignore the values that is below this value in textbox10 and above textBox13 if (filter_mask[i] > float.Parse(textBox10.Text) && filter_mask[i] < float.Parse(textBox13.Text)) { //Filter according to Vcnf if (maskVdccnf[i] > float.Parse(textBox5.Text) && maskVdccnf[i] < float.Parse(textBox6.Text)) { if (accuracyfaillist[i] == false) { //Vdcvbuglist.Addbug(CSVrowManager.GetaCSVrow(i)); chart3.Series[powermeter].Points.AddY(PM[i]); chart3.Series["pcuIacs"].Points.AddY(appartcurrent[i]); //**************************CHART4 load point************************* //Add bug plot to the line plot chart4.Series[pcureal].Points.AddXY(i, 0); chart4.Series[pcureal].Points.AddXY(i, 3); chart4.Series[pcureal].Points.AddXY(i, 0); //**********************Accumulate bugs to Chart 4**************** //if the series is empty then add something if (chart4.Series["Accumulate"].Points.Count == 0) { chart4.Series["Accumulate"].Points.AddXY(0, 0); } //If the series is empty then add something DataPoint datapoint = chart4.Series["Accumulate"].Points.FindByValue(i, "X", 0);//o is start index if (datapoint == null) { chart4.Series["Accumulate"].Points.AddXY(i, 1); } else { datapoint.SetValueY(datapoint.YValues.Last() + 1); } } } } } setbackground(chart3.Series[powermeter], chartarea); }
/// <summary> /// Atthis stage it plots and writes to richtext. Should change it. /// </summary> /// <param name="pcu">value from pcu</param> /// <param name="powermeter">value from power meter</param> /// <param name="cnf">configured value by the test</param> /// <param name="chartarea">The chart area name where data should go</param> /// <param name="FS">the fulscale value used for accuracy</param> /// <param name="filter_mask">the mask to filter plotted values</param> private void plot_general(string pcu, string powermeter, string cnf, string chartarea, float persent_fail_margin, List <float> filter_mask, List <float> maskVdccnf) { List <string> valuesforreport = new List <string>() { "Wacvarconfigured", "Wacconfigured", "Wdcconfigured", "Vdcconfigured", "Phaseconfigured", "Temperature", "Vacpowermeter" }; //clear series and add the series //chart3.Series.Clear(); //Get the column float values: (cnf is configured values) List <float> CNF = getfloatlist(cnf); List <float> PM = getfloatlist(powermeter); List <float> PCU = getfloatlist(pcu); //Get the bool fail list for specific margins (The ones are percentage 1) //convert double from the numericUpDown to float float failpersentage = persent_fail_margin; List <bool> accuracyfaillist = new List <bool>(Calculate.Pesentage_faillist(PCU, PM, failpersentage)); //**************************Setup chart4******************************************************** addlist_series_tochart(chart4, new List <string>() { pcu }); setupseriesline(chart4.Series[pcu]); //setup the color and the line type plot chart4.Series[pcu].Points.AddXY(0, 0); //Add the first dot to the line //******************************End chart 4 setup*********************************************** //*****************************Setup chart 3**************************************************** addlist_series_tochart(chart3, new List <string> { pcu, powermeter, cnf }); //List<bool> accuracyfaillist = new List<bool>(Calculate.Faillist(PCU, PM, 1, FS, 1)); chart3.Series[powermeter].ChartArea = chartarea; chart3.Series[cnf].ChartArea = chartarea; setupseriescross(chart3.Series[cnf]); setupseriescircle(chart3.Series[powermeter]); //****************************End setup chart 3************************************************* //Add a litte heading to the richtextbob richTextBox1.AppendText("*****************************" + pcu + "**********************************" + "\r\n"); for (int i = 0; i < PM.Count; i++) { //ignore the values that is below this value in textbox10 and above textBox13 if (filter_mask[i] > float.Parse(textBox10.Text) && filter_mask[i] < float.Parse(textBox13.Text)) { //Filter according to Vcnf if (maskVdccnf[i] > float.Parse(textBox5.Text) && maskVdccnf[i] < float.Parse(textBox6.Text)) { if (accuracyfaillist[i] == false) { if (CSVrowManager.GetaCSVrow(i) != null) { //Append text to the richtext box richTextBox1.AppendText(CSVrowManager.GetaCSVrow(i).Humantext(valuesforreport) + "\r\n"); //Add point to the chart chart3.Series[powermeter].Points.AddY(PM[i]); chart3.Series[cnf].Points.AddY(CNF[i]); //**************************CHART4************************* //Add bug plot to the line plot chart4.Series[pcu].Points.AddXY(i, 0); chart4.Series[pcu].Points.AddXY(i, 3); chart4.Series[pcu].Points.AddXY(i, 0); //**********************Accumulate bugs to Chart 4**************** //if the series is empty then add something if (chart4.Series["Accumulate"].Points.Count == 0) { chart4.Series["Accumulate"].Points.AddXY(0, 0); } //If the series is empty then add something DataPoint datapoint = chart4.Series["Accumulate"].Points.FindByValue(i, "X", 0);//o is start index if (datapoint == null) { chart4.Series["Accumulate"].Points.AddXY(i, 1); } else { datapoint.SetValueY(datapoint.YValues.Last() + 1); } } } } } } setbackground(chart3.Series[powermeter], chartarea); }