Recently, my knowledge is messy. Recently, it involves PLC automation control, Gas cabinet location prediction, and other aspects. The learning of PLC has been interrupted for a while. recently, it has come into contact with algorithms related to cabinet location prediction, such as neural networks and least square algorithms. Today, I will give a brief introduction to a small demo of Gas cabinet curve display. the implementation of relevant algorithms will be studied later. 1. use C # to display the interface curve
Recently, my knowledge is messy. Recently, it involves PLC automation control, Gas cabinet location prediction, and other aspects. The learning of PLC has been interrupted for a while. recently, it has come into contact with algorithms related to cabinet location prediction, such as neural networks and least square algorithms. Today, I will give a brief introduction to a small demo of Gas cabinet curve display. the implementation of relevant algorithms will be studied later.
1. display the interface curve
I chose C # for real-time curve display. C # has many report controls. after comparison, the zedgraph control of C # Open-source library is the best in real-time display curves, below is my real-time curve display code
Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. linq; using System. text; using System. windows. forms; using ZedGraph; using IGAI. util. excel; namespace ZedGraphExcelTest {public partial class Form1: Form {ExcelRead read; int count = 0; public Form1 () {InitializeComponent (); this. timeDraw. tick + = new EventHandler (timeDraw_Tick ); Read = new ExcelRead ();} private void Form1_Load (object sender, EventArgs e) {// Obtain GraphPane myPane = zgc. graphPane; // set the title myPane. title. text = "real-time curve"; // Set the x-axis description Text myPane. XAxis. title. text = "time"; // Set the y axis description Text myPane. YAxis. title. text = "Cabinet position"; RollingPointPairList list = new RollingPointPairList (86400); // start, the added line has no data points (that is, the list is empty) // add a name: Voltage, Color. red, unsigned, empty line without data LineItem curve = myPane. A DdCurve ("Cabinet", list, Color. red, SymbolType. none); timeDraw. interval = 50; // Set the timer control Interval to 50 milliseconds. enabled = true; // timer available timeDraw. start (); DateTime t1 = new DateTime (2014, 06, 01); DateTime t2 = new DateTime (2014, 06, 02); double min = new XDate (t1 ); double max = new XDate (t2); myPane. XAxis. scale. min = min; myPane. XAxis. scale. max = max; myPane. XAxis. scale. minorStep = (max-min)/24; // small scale Is 1 hour myPane. XAxis. scale. majorStep = (max-min)/6; // The scale is 4 hours. XAxis. type = AxisType. date; myPane. XAxis. scale. format = "yyyy-MM-dd \ nHH: mm: ss"; // change the zgc of the Axis scale. axisChange (); read. initExcelDrive ("test.xls", "0.3 million gas cabinet");} private void timeDraw_Tick (object sender, EventArgs e) {// ensure that CurveList is not empty if (zgc. graphPane. curveList. count <= 0) {return;} // obtain the first curve of Graph, that is, the first step: In GraphPane. search for CurveIt in the CurveList set Em LineItem curve = zgc. graphPane. curveList [0] as LineItem; if (curve = null) {return;} // Step 2: access PointPairList (or other IPointList) in CurveItem ), add new data or modify existing data as needed. IPointListEdit list = curve. points as IPointListEdit; if (list = null) {return;} DateTime time = new DateTime (); Double value =-1; if (read. isHasData () {time = read. getExcelDataDateTime (0); value = read. getExcelData (1);} XDate max = New XDate (time); XDate min = new XDate (time. addDays (-1); Scale xScale = zgc. graphPane. XAxis. scale; if (max> = xScale. max) {xScale. max = xScale. max + xScale. majorStep; xScale. min = xScale. min + xScale. majorStep;} list. add (max, value); if (value! =-1) {// Step 3: Call ZedGraphControl. the AxisChange () method updates the zgc range of the X and y axes. axisChange (); // Step 4: Call Form. the Invalidate () method updates the chart zgc. invalidate () ;}} private void Form1_Resize (object sender, EventArgs e) {SetSize () ;} private void SetSize () {// control always inserts a Rectangle in 10 pixels from the client to the form of Rectangle formRect = this. clientRectangle; formRect. inflate (-10,-10); if (zgc. size! = FormRect. Size) {zgc. Location = formRect. Location; zgc. Size = formRect. Size ;}}}}
2. read Excel data
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.OleDb;namespace IGAI.Util.Excel{ public class ExcelRead { private OleDbDataReader dataReader; private OleDbConnection oleDbConnection; public ExcelRead() { } ~ExcelRead() { clearExcelDrive(); } public bool initExcelDrive(string excelFilePath,string sheetName) { string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + excelFilePath + ";Extended Properties=Excel 8.0;"; dataReader = null; oleDbConnection = new OleDbConnection(strConn); OleDbCommand myOleDbCommand = new OleDbCommand("SELECT * FROM ["+sheetName+"$]", oleDbConnection); try { oleDbConnection.Open(); dataReader = myOleDbCommand.ExecuteReader(); return true; } catch (Exception ex) { Console.WriteLine(ex.ToString()); return false; } } public bool isHasData() { return dataReader.Read(); } public Object getExcelVaule(int colNum) { return dataReader.GetValue(colNum); } public Double getExcelData(int colNum) { return dataReader.GetDouble(colNum); } public String getExcelDataString(int colNum) { return dataReader.GetString(colNum); } public DateTime getExcelDataDateTime(int colNum) { return dataReader.GetDateTime(colNum); } public TimeSpan getExcelTimeSpan(int colNum) { return dataReader.GetTimeSpan(colNum); } public bool clearExcelDrive() { if (dataReader != null) dataReader.Close(); // Close the connection when done with it. if (oleDbConnection != null && oleDbConnection.State == System.Data.ConnectionState.Open) oleDbConnection.Close(); return true; } }}
3. popularize small gas knowledge of steel enterprises
COG) it is a by-product of the steel coking process. "coking is the process of converting coal into coke and coke oven gas by heating and dry distillation in the coke oven." It is divided into high temperature coking according to the temperature of coking! "Medium temperature coking and low temperature coking" are usually high temperature coking "the gas produced by coal during coking is the component of coal. during high temperature decomposition, the product" coal is gradually heated in case of air isolation. gas generation process:
The first stage is the decomposition of the basic material of coal. "carbon monoxide (CO) and carbon dioxide (coZ) are mainly produced ), therefore, the main components of COG generated during this period are CO and COZ. "The production amount of COG temperature during this period has a great relationship with the quality of coal." The final phase of the first stage continues until the temperature is 400e., at this time, the amount of gas escaped accounts for a small portion of the total amount of gas produced by normal coking"
The second stage is from the end of the first stage to the time when the temperature is 550e. This stage will produce a lot of gas. "coal tar produced in this stage is further decomposed due to the high temperature in the furnace, it turns into tar for high-temperature coking and produces gas at the same time. This part of gas is mainly made of hydrogen and many hydrocarbons! Made up of carbon and oxygen compounds, and is one of the final products of the original tar decomposition"
The third stage is to continue heating the semi-coke generated in the second stage until the final product is generated. "during this period, the gas overflow is relatively uniform, and its volume is about 40% of the total coking gas, the gas produced in this phase is mainly hydrogen and hydrogen compounds, which are obtained from the semi-coke produced in the second stage ".
BF Gas (BFG Blast Furnace Gas) is a by-product of BF ironmaking, with a low calorific value.
Converter Gas (LDG is Linz-Donawitz Process Gas), a by-product of BF steelmaking.
4. minor issues in this program
1) after running this demo, see:
2) when the horizontal axis is rolling up, the following three images are displayed:
This is a small bug in this demo. I have not found the cause yet. if you know it, I hope to reply to it. thank you.
This program can be downloaded here.