Пример #1
0
        protected override void ValidatingHandler(object sender, System.ComponentModel.CancelEventArgs e)
        {
            WetScrubber wetScrubber = this.WetScrubberCtrl.WetScrubber;
            TextBox     tb          = (TextBox)sender;

            if (tb.Text != null)
            {
                if (tb.Text.Trim().Equals(""))
                {
                    if (sender == this.textBoxName)
                    {
                        e.Cancel = true;
                        string message3 = "Please specify a name!";
                        MessageBox.Show(message3, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (sender == this.textBoxName)
                    {
                        ErrorMessage error = wetScrubber.SpecifyName(this.textBoxName.Text);
                        if (error != null)
                        {
                            UI.ShowError(error);
                        }
                    }
                }
            }
        }
Пример #2
0
        public WetScrubberControl(Flowsheet flowsheet, Point location, WetScrubber wetScrubber) :
            base(flowsheet, location, wetScrubber)
        {
            InitializeComponent();

            this.Size = new System.Drawing.Size(UI.UNIT_OP_CTRL_H, UI.UNIT_OP_CTRL_H);
            UI.SetStatusColor(this, this.WetScrubber.SolveState);
            this.UpdateBackImage();
        }
Пример #3
0
 public void InitializeVariableLabels(WetScrubber uo)
 {
     this.labelGasPressureDrop.InitializeVariable(uo.GasPressureDrop);
     this.labelCollectionEfficiency.InitializeVariable(uo.CollectionEfficiency);
     this.labelInletParticleLoading.InitializeVariable(uo.InletParticleLoading);
     this.labelOutletParticleLoading.InitializeVariable(uo.OutletParticleLoading);
     this.labelParticleCollectionRate.InitializeVariable(uo.ParticleCollectionRate);
     this.labelMassFlowRateOfParticleLostToGasOutlet.InitializeVariable(uo.MassFlowRateOfParticleLostToGasOutlet);
     this.labelLiquidToGasRatio.InitializeVariable(uo.LiquidToGasRatio);
 }
Пример #4
0
        public WetScrubberEditor(WetScrubberControl wetScrubberCtrl) : base(wetScrubberCtrl)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.inConstruction = true;
            WetScrubber wetScrubber = this.WetScrubberCtrl.WetScrubber;

            this.Text = "Wet Scrubber: " + wetScrubber.Name;
            this.UpdateStreamsUI();

            this.groupBoxWetScrubber          = new System.Windows.Forms.GroupBox();
            this.groupBoxWetScrubber.Location = new System.Drawing.Point(724, 24);
            this.groupBoxWetScrubber.Name     = "groupBoxWetScrubber";
            this.groupBoxWetScrubber.Text     = "Wet Scrubber";
            this.groupBoxWetScrubber.Size     = new System.Drawing.Size(280, 200);
            this.groupBoxWetScrubber.TabIndex = 128;
            this.groupBoxWetScrubber.TabStop  = false;
            this.panel.Controls.Add(this.groupBoxWetScrubber);

            // TO DO: to customizs the height? or not

            //         if (wetScrubber.GasInlet is DryingGasStream)
            //         {
            //            this.groupBoxGasStream.Size = new System.Drawing.Size(360, 280);
            //            this.panel.Size = new System.Drawing.Size(1010, 309);
            //            this.ClientSize = new System.Drawing.Size(1010, 331);
            //         }
            //         else if (wetScrubber.GasInlet is DryingMaterialStream)
            //         {
            this.groupBoxGasStream.Size = new System.Drawing.Size(360, 300);
            this.panel.Size             = new System.Drawing.Size(1010, 329);
            this.ClientSize             = new System.Drawing.Size(1010, 351);
            //         }
            this.groupBoxLiquidStream.Size = new System.Drawing.Size(360, 300);

            WetScrubberLabelsControl wetScrubberLabelsCtrl = new WetScrubberLabelsControl(this.WetScrubberCtrl.WetScrubber);

            this.groupBoxWetScrubber.Controls.Add(wetScrubberLabelsCtrl);
            wetScrubberLabelsCtrl.Location = new Point(4, 12 + 20 + 2);

            WetScrubberValuesControl wetScrubberValuesCtrl = new WetScrubberValuesControl(this.WetScrubberCtrl);

            this.groupBoxWetScrubber.Controls.Add(wetScrubberValuesCtrl);
            wetScrubberValuesCtrl.Location = new Point(196, 12 + 20 + 2);

            wetScrubberCtrl.WetScrubber.StreamAttached += new StreamAttachedEventHandler(WetScrubber_StreamAttached);
            wetScrubberCtrl.WetScrubber.StreamDetached += new StreamDetachedEventHandler(WetScrubber_StreamDetached);

            this.menuItemRating        = new MenuItem();
            this.menuItemRating.Index  = this.menuItemReport.Index + 1;
            this.menuItemRating.Text   = "Rating";
            this.menuItemRating.Click += new EventHandler(menuItemRating_Click);
            this.mainMenu.MenuItems.Add(this.menuItemRating);

            this.comboBoxCalculationType        = new System.Windows.Forms.ComboBox();
            this.labelCalculationType           = new System.Windows.Forms.Label();
            this.labelCalculationType.BackColor = Color.DarkGray;

            // comboBoxCalculationType
            this.comboBoxCalculationType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxCalculationType.Items.AddRange(new object[] {
                "Balance",
                "Rating"
            });
            this.comboBoxCalculationType.Location              = new System.Drawing.Point(492, 0);
            this.comboBoxCalculationType.Name                  = "comboBoxCalculationType";
            this.comboBoxCalculationType.Size                  = new System.Drawing.Size(80, 21);
            this.comboBoxCalculationType.TabIndex              = 7;
            this.comboBoxCalculationType.SelectedIndexChanged += new EventHandler(comboBoxCalculationType_SelectedIndexChanged);

            // labelCalculationType
            this.labelCalculationType.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.labelCalculationType.Location    = new System.Drawing.Point(300, 0);
            this.labelCalculationType.Name        = "labelCalculationType";
            this.labelCalculationType.Size        = new System.Drawing.Size(192, 20);
            this.labelCalculationType.TabIndex    = 5;
            this.labelCalculationType.Text        = "Calculation Type:";
            this.labelCalculationType.TextAlign   = System.Drawing.ContentAlignment.MiddleLeft;

            this.panel.Controls.Add(this.labelCalculationType);
            this.panel.Controls.Add(this.comboBoxCalculationType);

            this.comboBoxCalculationType.SelectedIndex = -1;
            this.inConstruction = false;
            this.SetCalculationType(this.WetScrubberCtrl.WetScrubber.CalculationType);
        }
Пример #5
0
        private void UpdateStreamsUI()
        {
            // clear the stream group-boxes and start again
            this.groupBoxGasStream.Controls.Clear();
            this.groupBoxLiquidStream.Controls.Clear();

            WetScrubber wetScrubber  = this.WetScrubberCtrl.WetScrubber;
            bool        hasGasIn     = false;
            bool        hasGasOut    = false;
            bool        hasLiquidIn  = false;
            bool        hasLiquidOut = false;

            ProcessStreamBase gasIn = wetScrubber.GasInlet;

            if (gasIn != null)
            {
                hasGasIn = true;
            }

            ProcessStreamBase gasOut = wetScrubber.GasOutlet;

            if (gasOut != null)
            {
                hasGasOut = true;
            }

            ProcessStreamBase liquidIn = wetScrubber.LiquidInlet;

            if (liquidIn != null)
            {
                hasLiquidIn = true;
            }

            ProcessStreamBase liquidOut = wetScrubber.LiquidOutlet;

            if (liquidOut != null)
            {
                hasLiquidOut = true;
            }

            if (hasGasIn || hasGasOut)
            {
                ProcessStreamBase labelsStream = null;
                if (hasGasIn)
                {
                    labelsStream = gasIn;
                }
                else if (hasGasOut)
                {
                    labelsStream = gasOut;
                }

                UserControl ctrl = null;
                if (labelsStream is ProcessStream)
                {
                    ctrl = new ProcessStreamLabelsControl((ProcessStream)labelsStream);
                }
                else if (labelsStream is DryingGasStream)
                {
                    ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream);
                }
                else if (labelsStream is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream);
                }
                this.groupBoxGasStream.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasGasIn)
            {
                UserControl ctrl = null;
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.GasInlet.Name);
                if (gasIn is ProcessStream)
                {
                    ProcessStreamControl processInCtrl = baseCtrl as ProcessStreamControl;
                    ctrl = new ProcessStreamValuesControl(processInCtrl);
                }
                else if (gasIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (gasIn is DryingMaterialStream)
                {
                    MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matInCtrl);
                }

                this.groupBoxGasStream.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxGasInName.SetSolvable(wetScrubber.GasInlet);
                this.groupBoxGasStream.Controls.Add(this.textBoxGasInName);
                this.textBoxGasInName.Text = wetScrubber.GasInlet.Name;
                UI.SetStatusColor(this.textBoxGasInName, wetScrubber.GasInlet.SolveState);
            }

            if (hasGasOut)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.GasOutlet.Name);
                UserControl ctrl = null;
                if (gasOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = baseCtrl as ProcessStreamControl;
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (gasOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                else if (gasOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }
                this.groupBoxGasStream.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

                this.textBoxGasOutName.SetSolvable(wetScrubber.GasOutlet);
                this.groupBoxGasStream.Controls.Add(this.textBoxGasOutName);
                this.textBoxGasOutName.Text = wetScrubber.GasOutlet.Name;
                UI.SetStatusColor(this.textBoxGasOutName, wetScrubber.GasOutlet.SolveState);
            }

            if (hasLiquidIn || hasLiquidOut)
            {
                ProcessStreamBase labelsStream = null;
                if (hasLiquidIn)
                {
                    labelsStream = liquidIn;
                }
                else if (hasLiquidOut)
                {
                    labelsStream = liquidOut;
                }

                UserControl ctrl = null;
                if (labelsStream is ProcessStream)
                {
                    ctrl = new ProcessStreamLabelsControl((ProcessStream)labelsStream);
                }
                else if (labelsStream is DryingGasStream)
                {
                    ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream);
                }
                else if (labelsStream is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream);
                }
                this.groupBoxLiquidStream.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasLiquidIn)
            {
                UserControl ctrl = null;
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.LiquidInlet.Name);
                if (liquidIn is ProcessStream)
                {
                    ProcessStreamControl processInCtrl = baseCtrl as ProcessStreamControl;
                    ctrl = new ProcessStreamValuesControl(processInCtrl);
                }
                else if (liquidIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (liquidIn is DryingMaterialStream)
                {
                    MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matInCtrl);
                }

                this.groupBoxLiquidStream.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxLiquidInName.SetSolvable(wetScrubber.LiquidInlet);
                this.groupBoxLiquidStream.Controls.Add(this.textBoxLiquidInName);
                this.textBoxLiquidInName.Text = wetScrubber.LiquidInlet.Name;
                UI.SetStatusColor(this.textBoxLiquidInName, wetScrubber.LiquidInlet.SolveState);
            }

            if (hasLiquidOut)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.LiquidOutlet.Name);
                UserControl ctrl = null;
                if (liquidOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = baseCtrl as ProcessStreamControl;
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (liquidOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                else if (liquidOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }
                this.groupBoxLiquidStream.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

                this.textBoxLiquidOutName.SetSolvable(wetScrubber.LiquidOutlet);
                this.groupBoxLiquidStream.Controls.Add(this.textBoxLiquidOutName);
                this.textBoxLiquidOutName.Text = wetScrubber.LiquidOutlet.Name;
                UI.SetStatusColor(this.textBoxLiquidOutName, wetScrubber.LiquidOutlet.SolveState);
            }
        }
Пример #6
0
 public WetScrubberLabelsControl(WetScrubber uo) : this()
 {
     this.InitializeVariableLabels(uo);
 }
Пример #7
0
 public WetScrubberControl(Flowsheet flowsheet, Point location, WetScrubber wetScrubber)
     : base(flowsheet, location, wetScrubber)
 {
 }
Пример #8
0
        private Flowsheet SetFlowsheetContent(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, ArrayList items, string flowsheetName)
        {
            Flowsheet   flowsheet = null;
            IEnumerator e         = items.GetEnumerator();

            while (e.MoveNext())
            {
                object obj = e.Current;

                if (obj is EvaporationAndDryingSystem)
                {
                    EvaporationAndDryingSystem persisted = (EvaporationAndDryingSystem)obj;
                    persisted.SetSystemFileName(flowsheetName); // call this before SetObjectData()
                    persisted.SetObjectData();
                    flowsheet = new Flowsheet(newProcessSettings, appPrefs, persisted);
                }

                else if (obj is GasStreamControl)
                {
                    GasStreamControl persistedCtrl = (GasStreamControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    DryingGasStream  stream        = flowsheet.EvaporationAndDryingSystem.GetGasStream(solvableName);
                    GasStreamControl newCtrl       = new GasStreamControl(flowsheet, new Point(0, 0), stream);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is MaterialStreamControl)
                {
                    MaterialStreamControl persistedCtrl = (MaterialStreamControl)obj;
                    string solvableName           = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    DryingMaterialStream  stream  = flowsheet.EvaporationAndDryingSystem.GetMaterialStream(solvableName);
                    MaterialStreamControl newCtrl = new MaterialStreamControl(flowsheet, new Point(0, 0), stream);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is DryerControl)
                {
                    DryerControl persistedCtrl = (DryerControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Dryer        uo            = flowsheet.EvaporationAndDryingSystem.GetDryer(solvableName);
                    DryerControl newCtrl       = new DryerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is HeatExchangerControl)
                {
                    HeatExchangerControl persistedCtrl = (HeatExchangerControl)obj;
                    string               solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    HeatExchanger        uo            = flowsheet.EvaporationAndDryingSystem.GetHeatExchanger(solvableName);
                    HeatExchangerControl newCtrl       = new HeatExchangerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CycloneControl)
                {
                    CycloneControl persistedCtrl = (CycloneControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Cyclone        uo            = flowsheet.EvaporationAndDryingSystem.GetCyclone(solvableName);
                    CycloneControl newCtrl       = new CycloneControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is EjectorControl)
                {
                    EjectorControl persistedCtrl = (EjectorControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Ejector        uo            = flowsheet.EvaporationAndDryingSystem.GetEjector(solvableName);
                    EjectorControl newCtrl       = new EjectorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is WetScrubberControl)
                {
                    WetScrubberControl persistedCtrl = (WetScrubberControl)obj;
                    string             solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    WetScrubber        uo            = flowsheet.EvaporationAndDryingSystem.GetWetScrubber(solvableName);
                    WetScrubberControl newCtrl       = new WetScrubberControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ScrubberCondenserControl)
                {
                    ScrubberCondenserControl persistedCtrl = (ScrubberCondenserControl)obj;
                    string                   solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    ScrubberCondenser        uo            = flowsheet.EvaporationAndDryingSystem.GetScrubberCondenser(solvableName);
                    ScrubberCondenserControl newCtrl       = new ScrubberCondenserControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is MixerControl)
                {
                    MixerControl persistedCtrl = (MixerControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Mixer        uo            = flowsheet.EvaporationAndDryingSystem.GetMixer(solvableName);
                    MixerControl newCtrl       = new MixerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is TeeControl)
                {
                    TeeControl persistedCtrl = (TeeControl)obj;
                    string     solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Tee        uo            = flowsheet.EvaporationAndDryingSystem.GetTee(solvableName);
                    TeeControl newCtrl       = new TeeControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is FlashTankControl)
                {
                    FlashTankControl persistedCtrl = (FlashTankControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    FlashTank        uo            = flowsheet.EvaporationAndDryingSystem.GetFlashTank(solvableName);
                    FlashTankControl newCtrl       = new FlashTankControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is FanControl)
                {
                    FanControl persistedCtrl = (FanControl)obj;
                    string     solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Fan        uo            = flowsheet.EvaporationAndDryingSystem.GetFan(solvableName);
                    FanControl newCtrl       = new FanControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ValveControl)
                {
                    ValveControl persistedCtrl = (ValveControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Valve        uo            = flowsheet.EvaporationAndDryingSystem.GetValve(solvableName);
                    ValveControl newCtrl       = new ValveControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is BagFilterControl)
                {
                    BagFilterControl persistedCtrl = (BagFilterControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    BagFilter        uo            = flowsheet.EvaporationAndDryingSystem.GetBagFilter(solvableName);
                    BagFilterControl newCtrl       = new BagFilterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is AirFilterControl)
                {
                    AirFilterControl persistedCtrl = (AirFilterControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    AirFilter        uo            = flowsheet.EvaporationAndDryingSystem.GetAirFilter(solvableName);
                    AirFilterControl newCtrl       = new AirFilterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CompressorControl)
                {
                    CompressorControl persistedCtrl = (CompressorControl)obj;
                    string            solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Compressor        uo            = flowsheet.EvaporationAndDryingSystem.GetCompressor(solvableName);
                    CompressorControl newCtrl       = new CompressorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is HeaterControl)
                {
                    HeaterControl persistedCtrl = (HeaterControl)obj;
                    string        solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Heater        uo            = flowsheet.EvaporationAndDryingSystem.GetHeater(solvableName);
                    HeaterControl newCtrl       = new HeaterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CoolerControl)
                {
                    CoolerControl persistedCtrl = (CoolerControl)obj;
                    string        solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Cooler        uo            = flowsheet.EvaporationAndDryingSystem.GetCooler(solvableName);
                    CoolerControl newCtrl       = new CoolerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ElectrostaticPrecipitatorControl)
                {
                    ElectrostaticPrecipitatorControl persistedCtrl = (ElectrostaticPrecipitatorControl)obj;
                    string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    ElectrostaticPrecipitator        uo      = flowsheet.EvaporationAndDryingSystem.GetElectrostaticPrecipitator(solvableName);
                    ElectrostaticPrecipitatorControl newCtrl = new ElectrostaticPrecipitatorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is PumpControl)
                {
                    PumpControl persistedCtrl = (PumpControl)obj;
                    string      solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Pump        uo            = flowsheet.EvaporationAndDryingSystem.GetPump(solvableName);
                    PumpControl newCtrl       = new PumpControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is RecycleControl)
                {
                    RecycleControl persistedCtrl = (RecycleControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Recycle        uo            = flowsheet.EvaporationAndDryingSystem.GetRecycle(solvableName);
                    RecycleControl newCtrl       = new RecycleControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is SolvableConnection)
                {
                    SolvableConnection persistedDc = (SolvableConnection)obj;
                    SolvableConnection dc          = new SolvableConnection(flowsheet);
                    dc.SetObjectData(persistedDc.SerializationInfo, persistedDc.StreamingContext);
                    flowsheet.ConnectionManager.Connections.Add(dc);
                }
                else if (obj is FlowsheetPreferences)
                {
                    FlowsheetPreferences flowsheetPrefs = obj as FlowsheetPreferences;
                    flowsheetPrefs.SetObjectData(flowsheetPrefs.SerializationInfo, flowsheetPrefs.StreamingContext);
                    flowsheet.BackColor = flowsheetPrefs.BackColor;
                }
                else if (obj is ProsimoUI.CustomEditor.CustomEditor)
                {
                    ProsimoUI.CustomEditor.CustomEditor persistedEditor = (ProsimoUI.CustomEditor.CustomEditor)obj;
                    flowsheet.CustomEditor.SetObjectData(persistedEditor.SerializationInfo, persistedEditor.StreamingContext);
                }
            }

            if (this.CheckFlowsheetVersion(items, flowsheet))
            {
                flowsheet.IsDirty = false;
            }
            else
            {
                flowsheet = null;
            }

            return(flowsheet);
        }
Пример #9
0
        private void WetScrubber_SolveComplete(object sender, SolveState solveState)
        {
            WetScrubber wetScrubber = sender as WetScrubber;

            this.SetScrubberType(wetScrubber.ScrubberType);
        }
Пример #10
0
        private void UpdateStreamsUI()
        {
            // clear the stream group-boxes and start again
            //this.groupBoxGasStream.Controls.Clear();
            //this.groupBoxLiquidStream.Controls.Clear();

            WetScrubber wetScrubber  = this.WetScrubberCtrl.WetScrubber;
            bool        hasGasIn     = false;
            bool        hasGasOut    = false;
            bool        hasLiquidIn  = false;
            bool        hasLiquidOut = false;

            ProcessStreamBase gasIn = wetScrubber.GasInlet;

            if (gasIn != null)
            {
                hasGasIn = true;
            }

            ProcessStreamBase gasOut = wetScrubber.GasOutlet;

            if (gasOut != null)
            {
                hasGasOut = true;
            }

            ProcessStreamBase liquidIn = wetScrubber.LiquidInlet;

            if (liquidIn != null)
            {
                hasLiquidIn = true;
            }

            ProcessStreamBase liquidOut = wetScrubber.LiquidOutlet;

            if (liquidOut != null)
            {
                hasLiquidOut = true;
            }

            if (hasGasIn)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.GasInlet.Name);
                initializeGrid(baseCtrl, columnIndex, false, "Gas Inlet/Outlet");
                columnIndex += 2;
            }

            if (hasGasOut)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.GasOutlet.Name);
                if (hasGasIn)
                {
                    initializeGrid(baseCtrl, columnIndex, true, "Gas Inlet/Outlet");
                    columnIndex++;
                }
                else
                {
                    initializeGrid(baseCtrl, columnIndex, false, "Gas Inlet/Outlet");
                    columnIndex += 2;
                }

                //this.textBoxGasOutName.Text = wetScrubber.GasOutlet.Name;
                //UI.SetStatusColor(this.textBoxGasOutName, wetScrubber.GasOutlet.SolveState);
            }

            if (hasLiquidIn)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.LiquidInlet.Name);
                initializeGrid(baseCtrl, columnIndex, false, "Liquid Inlet/Outlet");
                columnIndex += 2;
            }

            if (hasLiquidOut)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.LiquidOutlet.Name);
                if (hasLiquidIn)
                {
                    initializeGrid(baseCtrl, columnIndex, true, "Liquid Inlet/Outlet");
                    columnIndex++;
                }
                else
                {
                    initializeGrid(baseCtrl, columnIndex, false, "Liquid Inlet/Outlet");
                    columnIndex += 2;
                }

                //this.textBoxLiquidOutName.Text = wetScrubber.LiquidOutlet.Name;
                //UI.SetStatusColor(this.textBoxLiquidOutName, wetScrubber.LiquidOutlet.SolveState);
            }
        }