示例#1
0
        private void bindTowerInfo()
        {
            if (dsTower.Tables.Count > 0 && dsTower.Tables[0].Rows.Count > 0)
            {
                DataRow dr = dsTower.Tables[0].Rows[0];
                txtName.Text = dr["eqname"].ToString();
                //txtDescription.Text = dr["description"].ToString();
                txtStageNumber.Text = dr["numberoftrays"].ToString();

                DBRelief dbReader = new DBRelief(dbFile);
                Dictionary <string, string> dicFeeds    = new Dictionary <string, string>();
                Dictionary <string, string> dicProducts = new Dictionary <string, string>();
                dbReader.getMaincolumnRealFeedProduct(dr["eqname"].ToString(), ref dicFeeds, ref dicProducts);

                DBRelief dbR = new DBRelief(dbFile);
                foreach (KeyValuePair <string, string> feed in dicFeeds)
                {
                    DataRow r = dtFeed.NewRow();
                    r["streamname"] = feed.Key;
                    r["tray"]       = feed.Value;
                    r["visiofile"]  = vsdFile;
                    dbR.getAndConvertStreamInfo(feed.Key, ref r);
                    dtFeed.Rows.Add(r);

                    DataRow rsource = dtSource.NewRow();
                    rsource["streamname"]                = feed.Key;
                    rsource["sourcename"]                = feed.Key + "_Source";
                    rsource["visiofile"]                 = vsdFile;
                    rsource["ismaintained"]              = false;
                    rsource["sourcetype"]                = "Pump(Motor)";
                    rsource["maxpossiblepressure"]       = r["pressure"].ToString();
                    rsource["maxpossiblepressure_color"] = "green";
                    dtSource.Rows.Add(rsource);
                }

                foreach (KeyValuePair <string, string> prodcut in dicProducts)
                {
                    DataRow r = dtProd.NewRow();
                    r["streamname"] = prodcut.Key;
                    r["tray"]       = prodcut.Value;
                    r["visiofile"]  = vsdFile;
                    dbR.getAndConvertStreamInfo(prodcut.Key, ref r);
                    dtProd.Rows.Add(r);

                    DataRow rsink = dtSink.NewRow();
                    rsink["streamname"]                = prodcut.Key;
                    rsink["sinkname"]                  = prodcut.Key + "_Sink";
                    rsink["visiofile"]                 = vsdFile;
                    rsink["ismaintained"]              = false;
                    rsink["sinktype"]                  = "Pump(Motor)";
                    rsink["maxpossiblepressure"]       = r["pressure"].ToString();
                    rsink["maxpossiblepressure_color"] = "green";

                    dtSink.Rows.Add(rsink);
                }

                string   heaterNames      = dr["HeaterNames"].ToString();
                string   heaterDuties     = dr["HeaterDuties"].ToString();
                string   heaterTrayLoc    = dr["HeaterTrayLoc"].ToString();
                string[] arrHeaterNames   = heaterNames.Split(',');
                string[] arrHeaterDuties  = heaterDuties.Split(',');
                string[] arrHeaterTrayLoc = heaterTrayLoc.Split(',');
                for (int i = 0; i < arrHeaterNames.Length; i++)
                {
                    decimal duty = decimal.Parse(arrHeaterDuties[i]) / 1000;
                    duty = decimal.Round(duty, 4);
                    if (arrHeaterNames[i] == "CONDENSER")
                    {
                        DataRow r = dtCondenser.NewRow();
                        r["heatername"]  = arrHeaterNames[i];
                        r["heaterduty"]  = duty;
                        r["visiofile"]   = vsdFile;
                        r["water"]       = duty;
                        r["waterfactor"] = 1;
                        r["ishx"]        = false;

                        r["air"]              = 0;
                        r["airfactor"]        = 0;
                        r["wetair"]           = 0;
                        r["wetairfactor"]     = 0;
                        r["pumpabound"]       = 0;
                        r["pumpaboundfactor"] = 0;

                        r["heatername_color"]  = "green";
                        r["heaterduty_color"]  = "green";
                        r["water_color"]       = "green";
                        r["waterfactor_color"] = "green";
                        dtCondenser.Rows.Add(r);
                    }
                    else if (arrHeaterNames[i] == "REBOILER")
                    {
                        DataRow r = dtReboiler.NewRow();
                        r["heatername"]  = arrHeaterNames[i];
                        r["heaterduty"]  = duty;
                        r["visiofile"]   = vsdFile;
                        r["steam"]       = duty;
                        r["steamfactor"] = 1;

                        r["hotstream"]       = 0;
                        r["hotstreamfactor"] = 0;
                        r["hotoil"]          = 0;
                        r["hotoilfactor"]    = 0;
                        r["furnace"]         = 0;
                        r["furnacefactor"]   = 0;

                        r["ishx"]        = false;
                        r["iscontinued"] = false;


                        dtReboiler.Rows.Add(r);
                    }
                    else if (double.Parse(arrHeaterDuties[i]) <= 0 && arrHeaterNames[i] != "CONDENSER")
                    {
                        if (arrHeaterTrayLoc[i] == "1")
                        {
                            DataRow r = dtCondenser.NewRow();
                            r["heatername"]       = arrHeaterNames[i];
                            r["heaterduty"]       = duty;
                            r["visiofile"]        = vsdFile;
                            r["water"]            = duty;
                            r["waterfactor"]      = 1;
                            r["ishx"]             = false;
                            r["air"]              = 0;
                            r["airfactor"]        = 0;
                            r["wetair"]           = 0;
                            r["wetairfactor"]     = 0;
                            r["pumpabound"]       = 0;
                            r["pumpaboundfactor"] = 0;
                            dtCondenser.Rows.Add(r);
                        }
                        else
                        {
                            DataRow r = dtHxCondenser.NewRow();
                            r["heatername"]  = arrHeaterNames[i];
                            r["heaterduty"]  = duty;
                            r["visiofile"]   = vsdFile;
                            r["water"]       = duty;
                            r["waterfactor"] = 1;
                            r["ishx"]        = true;

                            r["air"]              = 0;
                            r["airfactor"]        = 0;
                            r["wetair"]           = 0;
                            r["wetairfactor"]     = 0;
                            r["pumpabound"]       = 0;
                            r["pumpaboundfactor"] = 0;
                            dtHxCondenser.Rows.Add(r);
                        }
                    }
                    else if (double.Parse(arrHeaterDuties[i]) > 0 && arrHeaterNames[i] != "REBOILER")
                    {
                        if (arrHeaterTrayLoc[i] == dr["numberoftrays"].ToString())
                        {
                            DataRow r = dtReboiler.NewRow();
                            r["heatername"]  = arrHeaterNames[i];
                            r["heaterduty"]  = duty;
                            r["visiofile"]   = vsdFile;
                            r["steam"]       = duty;
                            r["steamfactor"] = 1;
                            r["ishx"]        = false;
                            r["iscontinued"] = false;

                            r["hotstream"]       = 0;
                            r["hotstreamfactor"] = 0;
                            r["hotoil"]          = 0;
                            r["hotoilfactor"]    = 0;
                            r["furnace"]         = 0;
                            r["furnacefactor"]   = 0;
                            dtReboiler.Rows.Add(r);
                        }
                        else
                        {
                            DataRow r = dtHxReboiler.NewRow();
                            r["heatername"]  = arrHeaterNames[i];
                            r["heaterduty"]  = duty;
                            r["visiofile"]   = vsdFile;
                            r["steam"]       = duty;
                            r["steamfactor"] = 1;
                            r["ishx"]        = true;
                            r["iscontinued"] = false;

                            r["hotstream"]       = 0;
                            r["hotstreamfactor"] = 0;
                            r["hotoil"]          = 0;
                            r["hotoilfactor"]    = 0;
                            r["furnace"]         = 0;
                            r["furnacefactor"]   = 0;



                            dtHxReboiler.Rows.Add(r);
                        }
                    }
                }
            }
            dtFeed_init        = dtFeed.Copy();
            dtProd_init        = dtProd.Copy();
            dtCondenser_init   = dtCondenser.Copy();
            dtHxCondenser_init = dtHxCondenser.Copy();
            dtReboiler_init    = dtReboiler.Copy();
            dtHxReboiler_init  = dtHxReboiler.Copy();
        }