public WorkForm() { dataOpen = new myclass[11]; int i = 0; while (i != 11) { dataOpen[i] = new myclass(); i++; } CallBackMy.callbackEventHandler = new CallBackMy.callbackEvent(this.ReloadWork); if (!workTimer.Enabled) { workTimer.Tick += new EventHandler(timer_work); //подписываемся на события Tick workTimer.Interval = 200; workTimer.Start(); } InitializeComponent(); ToolTip help = new ToolTip(); help.SetToolTip(prevOpenForm, "Переход на начальное окно"); help.SetToolTip(nextPowerButton, "Переход на построение мощностной характеристики"); help.SetToolTip(upPozReostatButton, "Понижение ступени реостата"); help.SetToolTip(downPozReostatButton,"Повышение ступени реостата"); }
public openForm() { dataOpen = new myclass[11]; int i = 0; while (i != 11) { dataOpen[i] = new myclass(); i++; } CallBackMy.callbackEventHandler = new CallBackMy.callbackEvent(this.Reload); CallBackMy.callbackEventHandlerFIO = new CallBackMy.callbackEventFIO(this.ReloadFio); CallBackMy.callbackEventHandlerComment = new CallBackMy.callbackEventComment(this.ReloadComment); CallBackMy.callbackEventHandlerCheck = new CallBackMy.callbackEventCheck(this.ReloadCheck); if (!openTimer.Enabled) { openTimer.Tick += new EventHandler(timer_open); //подписываемся на события Tick openTimer.Interval = 200; openTimer.Start(); } InitializeComponent(); ToolTip help = new ToolTip(); help.SetToolTip(nextWorkForm, "Переход на измерительное окно"); help.SetToolTip(Exit, "Выход из программы без сохранения данных"); help.SetToolTip(saveReport, "Сохранение данных испытания на диске"); help.SetToolTip(printReport, "Предомсотр и печать отчета"); help.SetToolTip(listReport, "Список отчетов за все время по выбранному тепловозу"); help.SetToolTip(newLocButton, "Внесение в базу данных нового локомотива"); }
public OkReport() { dataOpen = new myclass[11]; int i = 0; while (i != 11) { dataOpen[i] = new myclass(); i++; } CallBackMy.callbackEventHandler = new CallBackMy.callbackEvent(this.Reload); InitializeComponent(); }
public GraphPowerForm() { flagReload=false; dataOpen = new myclass[11]; int i = 0; while (i != 11) { dataOpen[i] = new myclass(); i++; } CallBackMy.callbackEventHandler = new CallBackMy.callbackEvent(this.ReloadWork); InitializeComponent(); }
public GraphExternForm() { flagReload = false; extData = new ExtData(); dataOpen = new myclass[11]; int i = 0; while (i != 11) { dataOpen[i] = new myclass(); i++; } CallBackMy.callbackEventHandler = new CallBackMy.callbackEvent(this.ReloadWork); if (!externTimer.Enabled) { externTimer.Tick += new EventHandler(timer_extern); //подписываемся на события Tick externTimer.Interval = 1000; externTimer.Start(); } InitializeComponent(); }
void ReloadWork(myclass[] param) { flagReload = true; dataOpen = param; }
void ReloadWork(myclass[] param) { dataOpen = param; }
void Reload(myclass[] param) { flagReloadreport = true; dataOpen = param; }
static void func() { CallBackMy.callbackEventHandlerPozReostat = new CallBackMy.callbackEventPozReostat(ReloadPoz); CallBackMy.callbackEventHandlerPozKM = new CallBackMy.callbackEventPozKM(ReloadPozKM); CallBackMy.callbackEventHandlerTypeLoc = new CallBackMy.callbackEventTypeLoc(ReloadTypeLoc); CallBackMy.callbackEventHandlerNumberLoc = new CallBackMy.callbackEventNumberLoc(ReloadNumberLoc); CallBackMy.callbackEventHandlerExtPoint = new CallBackMy.callbackEventExtPoint(ReloadExtPoint); CallBackMy.callbackEventHandlerNew = new CallBackMy.callbackEventNew(ReloadData); int pozTeplovozPrev = 0; int pozTeplovoz = 0; pozReostat = 0; dataClass = new myclass[11]; int i=0; while (i != 11) { dataClass[i] = new myclass(); i++; } CRC crc = new CRC(); DefPoz def = new DefPoz(); PowerData[] powerData = new PowerData[9]; i = 0; while (i != 9) { powerData[i] = new PowerData(); i++; } web = new webserver(); IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); IPAddress ipAddress = ipHostInfo.AddressList[0]; web.start(ipAddress, 80, 5, @".\"); Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPAddress ip = IPAddress.Any; IPEndPoint ipe = new IPEndPoint(ip, 128); s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); s.Bind(ipe); byte[] buffer = new byte[1024]; IPAddress ipRem = IPAddress.Any; int portRem = 128; IPEndPoint Rem = new IPEndPoint(ipRem, portRem); EndPoint EndRem = (EndPoint)Rem; XmlDocument parserXml = new XmlDocument(); string error; Thread.Sleep(200); for (; ; ) { Thread.Sleep(200); if (s.Available > 0) { s.ReceiveFrom(buffer, ref EndRem); data = Encoding.ASCII.GetString(buffer); data.IndexOf("<EOF>"); data = data.Remove(data.IndexOf("<EOF>"), 5); try { parserXml.LoadXml(data); } catch (Exception e) { error = e.ToString(); } XmlNodeList xml; xml = parserXml.GetElementsByTagName("owtemp"); if (xml.Count > 0) owtemp = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("current"); if(xml.Count>0) dataClass[10].Current = (int)(Math.Abs(Convert.ToInt32(xml[0].InnerText) * 1500 / 4095)); xml = parserXml.GetElementsByTagName("voltage"); if (xml.Count > 0) dataClass[10].Voltage = (int)(Math.Abs(Convert.ToInt32(xml[0].InnerText) * 1000 / 4095)); xml = parserXml.GetElementsByTagName("voltagebort"); if (xml.Count > 0) dataClass[10].VoltageBort = (int)(Convert.ToInt32(xml[0].InnerText)); xml = parserXml.GetElementsByTagName("tempbort"); if (xml.Count > 0) dataClass[10].TempBort = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("tempgas1"); if (xml.Count > 0) dataClass[10].TempCil1 = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("tempgas2"); if (xml.Count > 0) dataClass[10].TempCil2 = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("tempgas3"); if (xml.Count > 0) dataClass[10].TempCil3 = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("tempgas4"); if (xml.Count > 0) dataClass[10].TempCil4 = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("tempgas5"); if (xml.Count > 0) dataClass[10].TempCil5 = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("tempgas6"); if (xml.Count > 0) dataClass[10].TempCil6 = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("rpm"); if (xml.Count > 0) dataClass[10].RpmDGU = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("tempwater"); if (xml.Count > 0) dataClass[10].TempWater = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("tempoil"); if (xml.Count > 0) dataClass[10].TempOil = Convert.ToInt32(xml[0].InnerText); xml = parserXml.GetElementsByTagName("pressoil"); if (xml.Count > 0) dataClass[10].PressGas = Convert.ToInt32(xml[0].InnerText) / 100.0 ; xml = parserXml.GetElementsByTagName("pressgas"); if (xml.Count > 0) dataClass[10].PressOil = Convert.ToInt32(xml[0].InnerText) / 100.0; xml = parserXml.GetElementsByTagName("pozteplovoz"); if (xml.Count > 0) { def.DefinitionPoz(xml[0].InnerText, typeLoc); if (flagExt == false) dataClass[10].PozDGU = def.PozDGU;//рабочее else dataClass[10].PozDGU = pozExt; pozTeplovoz = dataClass[10].PozDGU; dataClass[10].StateVSH1 = def.StateVSH1; dataClass[10].StateVSH2 = def.StateVSH2; } } if (flagExt == true) { dataClass[10].PozDGU = pozExt; pozTeplovoz = dataClass[10].PozDGU; } if (pozTeplovoz != pozTeplovozPrev) { pozTeplovozPrev = pozTeplovoz; checkTimer = false; countTimer = 0; dataClass[10].FlagValid = false; } if ((pozTeplovoz == 8) && (dataClass[10].Current > 300)) dataClass[10].Power = (int)(((dataClass[10].Current * dataClass[10].Voltage) / 1000) + (dataClass[10].TempBort - 20)); else dataClass[10].Power = (dataClass[10].Current * dataClass[10].Voltage) / 1000; dataClass[10].TypeLoc = typeLoc; dataClass[10].NumberLoc = numberLoc; dataClass[10].PozReostat = pozReostat; if ((checkTimer == true) && (checkSecund == true)) { checkSecund = false; string htmTeg; string text = System.IO.File.ReadAllText(@".\index.html"); htmTeg = "<!--current-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].Current.ToString()); htmTeg = "<!--voltage-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].Voltage.ToString()); htmTeg = "<!--voltagebort-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].VoltageBort.ToString()); htmTeg = "<!--power-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].Power.ToString()); htmTeg = "<!--rpmdgu-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].RpmDGU.ToString()); htmTeg = "<!--tempwater-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempWater.ToString()); htmTeg = "<!--tempoil-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempOil.ToString()); htmTeg = "<!--pressoil-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].PressOil.ToString()); htmTeg = "<!--tempgas1-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempCil1.ToString()); htmTeg = "<!--tempgas2-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempCil2.ToString()); htmTeg = "<!--tempgas3-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempCil3.ToString()); htmTeg = "<!--tempgas4-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempCil4.ToString()); htmTeg = "<!--tempgas5-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempCil5.ToString()); htmTeg = "<!--tempgas6-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempCil6.ToString()); htmTeg = "<!--tempbort-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].TempBort.ToString()); htmTeg = "<!--pozteplovoz-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].PozDGU.ToString()); htmTeg = "<!--pozreostat-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, dataClass[10].PozReostat.ToString()); htmTeg = "<!--owtemp-->"; text = text.Insert(text.IndexOf(htmTeg) + htmTeg.Length, owtemp.ToString()); web.stringHtml(text); if ((dataClass[10].Current > 20) && (dataClass[10].Voltage > 20)&&(pozTeplovoz > 0)) { dataClass[pozTeplovoz].Current = dataClass[10].Current; dataClass[pozTeplovoz].Voltage = dataClass[10].Voltage; dataClass[pozTeplovoz].TempOil = dataClass[10].TempOil; dataClass[pozTeplovoz].TempWater = dataClass[10].TempWater; dataClass[pozTeplovoz].TempCil1 = dataClass[10].TempCil1; dataClass[pozTeplovoz].TempCil2 = dataClass[10].TempCil2; dataClass[pozTeplovoz].TempCil3 = dataClass[10].TempCil3; dataClass[pozTeplovoz].TempCil4 = dataClass[10].TempCil4; dataClass[pozTeplovoz].TempCil5 = dataClass[10].TempCil5; dataClass[pozTeplovoz].TempCil6 = dataClass[10].TempCil6; dataClass[pozTeplovoz].Power = dataClass[10].Power; dataClass[pozTeplovoz].PozDGU = pozTeplovoz; dataClass[pozTeplovoz].PressGas = dataClass[10].PressGas; dataClass[pozTeplovoz].PressOil = dataClass[10].PressOil; dataClass[pozTeplovoz].RpmDGU = dataClass[10].RpmDGU; dataClass[pozTeplovoz].Time++; dataClass[pozTeplovoz].VoltageBort = dataClass[10].VoltageBort; if (pozTeplovoz<9) if (powerData[pozTeplovoz].pushData(dataClass[10].Power) == true) { dataClass[pozTeplovoz].PowerDGU = powerData[pozTeplovoz].ResultPower(); } } else { if (pozTeplovoz == 0) { dataClass[pozTeplovoz].Current = dataClass[10].Current; dataClass[pozTeplovoz].Voltage = dataClass[10].Voltage; dataClass[pozTeplovoz].TempOil = dataClass[10].TempOil; dataClass[pozTeplovoz].TempWater = dataClass[10].TempWater; dataClass[pozTeplovoz].TempCil1 = dataClass[10].TempCil1; dataClass[pozTeplovoz].TempCil2 = dataClass[10].TempCil2; dataClass[pozTeplovoz].TempCil3 = dataClass[10].TempCil3; dataClass[pozTeplovoz].TempCil4 = dataClass[10].TempCil4; dataClass[pozTeplovoz].TempCil5 = dataClass[10].TempCil5; dataClass[pozTeplovoz].TempCil6 = dataClass[10].TempCil6; dataClass[pozTeplovoz].Power = 0; dataClass[pozTeplovoz].PozDGU = 0; dataClass[pozTeplovoz].PressGas = dataClass[10].PressGas; dataClass[pozTeplovoz].PressOil = dataClass[10].PressOil; dataClass[pozTeplovoz].RpmDGU = dataClass[10].RpmDGU; dataClass[pozTeplovoz].Time++; dataClass[pozTeplovoz].VoltageBort = dataClass[10].VoltageBort; } } dataClass[10].Time++; dataClass[10].ExtDataPoint = extData; } if (dataClass[10].StateVSH1 != preStateRP1) { if (dataClass[10].StateVSH1 == true) { if (dataClass[10].SwitchRelePoint.RP1_ON_current == 0) { dataClass[10].SwitchRelePoint.RP1_ON_current = dataClass[10].Current; dataClass[10].SwitchRelePoint.RP1_ON_voltage = dataClass[10].Voltage; } else { dataClass[10].SwitchRelePoint.RP1_ON_current = dataClass[10].Current; dataClass[10].SwitchRelePoint.RP1_ON_voltage = dataClass[10].Voltage; } } else { if (dataClass[10].SwitchRelePoint.RP1_OFF_current == 0) { dataClass[10].SwitchRelePoint.RP1_OFF_current = dataClass[10].Current; dataClass[10].SwitchRelePoint.RP1_OFF_voltage = dataClass[10].Voltage; } else { dataClass[10].SwitchRelePoint.RP1_OFF_current = dataClass[10].Current; dataClass[10].SwitchRelePoint.RP1_OFF_voltage = dataClass[10].Voltage; } } } if (dataClass[10].StateVSH2 != preStateRP2) { if (dataClass[10].StateVSH2 == true) { if (dataClass[10].SwitchRelePoint.RP2_ON_current == 0) { dataClass[10].SwitchRelePoint.RP2_ON_current = dataClass[10].Current; dataClass[10].SwitchRelePoint.RP2_ON_voltage = dataClass[10].Voltage; } else { dataClass[10].SwitchRelePoint.RP2_ON_current = dataClass[10].Current; dataClass[10].SwitchRelePoint.RP2_ON_voltage = dataClass[10].Voltage; } } else { if (dataClass[10].SwitchRelePoint.RP2_OFF_current == 0) { dataClass[10].SwitchRelePoint.RP2_OFF_current = dataClass[10].Current; dataClass[10].SwitchRelePoint.RP2_OFF_voltage = dataClass[10].Voltage; } else { dataClass[10].SwitchRelePoint.RP2_OFF_current = dataClass[10].Current; dataClass[10].SwitchRelePoint.RP2_OFF_voltage = dataClass[10].Voltage; } } } preStateRP1 = dataClass[10].StateVSH1; preStateRP2 = dataClass[10].StateVSH2; if (pozReostat != 0) { dataClass[10].FlagWork = true; } CallBackMy.callbackEventHandler(dataClass); /*temp***************************************/ /*dataClass[10].Current = 1256; dataClass[10].Voltage = 356; dataClass[10].TempOil = 78; dataClass[10].TempWater = 67; dataClass[10].TempCil1 = 567; dataClass[10].TempCil2 = 456; dataClass[10].TempCil3 = 45; dataClass[10].TempCil4 = 567; dataClass[10].TempCil5 = 656; dataClass[10].TempCil6 = 34; dataClass[10].PozDGU = 3; dataClass[10].PressGas = 0.53; dataClass[10].PressOil = 2.56; dataClass[10].RpmDGU = 430; dataClass[10].VoltageBort = 75;*/ /****************************************/ } }
static void ReloadData(myclass[] what) { dataClass = what; extData = dataClass[10].ExtDataPoint; }