Cabinet Position prediction (1)-display the cabinet position curve

Source: Internet
Author: User

Cabinet Position prediction (1)-display the cabinet position 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.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.