Beispiel #1
0
        private void UpdateTheUI()
        {
            this.panel.Visible = false;

            this.userCtrlFractions.Visible = false;
            this.userCtrlFractions.Controls.Clear();

            this.groupBoxStreams.Visible = false;
            this.groupBoxStreams.Controls.Clear();
            this.outletControls.Clear();

            int x = INITIAL_LOCATION;
            int w = VALUE_WIDTH;
            int s = INITIAL_GROUPBOX_WIDTH;
            int p = INITIAL_FORM_WIDTH;

            Tee  tee          = this.TeeCtrl.Tee;
            bool hasStreamIn  = false;
            bool hasStreamOut = false;

            ProcessStreamBase streamOut = null;

            if (tee.OutletStreams.Count > 0)
            {
                hasStreamOut = true;
                streamOut    = (ProcessStreamBase)tee.OutletStreams[0];
                this.userCtrlFractions.Visible = true;
            }

            ProcessStreamBase streamIn = tee.Inlet;

            if (streamIn != null)
            {
                hasStreamIn = true;
            }

            if (hasStreamIn || hasStreamOut)
            {
                this.groupBoxStreams.Visible = true;
                ProcessStreamBase labelsStream = null;
                if (hasStreamIn)
                {
                    labelsStream = streamIn;
                }
                else if (hasStreamOut)
                {
                    labelsStream = streamOut;
                }

                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);
                }
                ctrl.Location                   = new Point(4, 12 + 20 + 2);
                this.groupBoxStreams.Size       = new Size(s, this.groupBoxHeight);
                this.groupBoxFractions.Location = new System.Drawing.Point(this.groupBoxStreams.Width + 4, 24);
                this.groupBoxStreams.Controls.Add(ctrl);
                s = s + w;
                p = p + w;
            }

            if (hasStreamIn)
            {
                UserControl ctrl = null;
                if (streamIn is ProcessStream)
                {
                    ProcessStreamControl processInCtrl = (ProcessStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamIn.Name);
                    ctrl = new ProcessStreamValuesControl(processInCtrl);
                }
                else if (streamOut is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = (GasStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamIn.Name);
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (streamOut is DryingMaterialStream)
                {
                    MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamIn.Name);
                    ctrl = new MaterialStreamValuesControl(materialInCtrl);
                }
                ctrl.Location                   = new Point(x, 12 + 20 + 2);
                this.groupBoxStreams.Size       = new Size(s, this.groupBoxHeight);
                this.groupBoxFractions.Location = new System.Drawing.Point(this.groupBoxStreams.Width + 4, 24);
                this.groupBoxStreams.Controls.Add(ctrl);
                this.Size = new Size(p, this.formHeight);

                this.textBoxStreamInName.Text     = streamIn.Name;
                this.textBoxStreamInName.Location = new Point(x, 12);

                this.textBoxStreamInName.SetSolvable(streamIn);
                this.groupBoxStreams.Controls.Add(this.textBoxStreamInName);
                UI.SetStatusColor(this.textBoxStreamInName, streamIn.SolveState);
            }

            if (hasStreamOut)
            {
                IEnumerator e = tee.OutletStreams.GetEnumerator();
                while (e.MoveNext())
                {
                    s = s + w;
                    x = x + w;
                    p = p + w;

                    ProcessStreamBase processStreamBase = (ProcessStreamBase)e.Current;
                    UserControl       ctrl = null;
                    if (processStreamBase is ProcessStream)
                    {
                        ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name);
                        ctrl = new ProcessStreamValuesControl(processOutCtrl);
                    }
                    else if (processStreamBase is DryingGasStream)
                    {
                        GasStreamControl gasOutCtrl = (GasStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name);
                        ctrl = new GasStreamValuesControl(gasOutCtrl);
                    }
                    else if (processStreamBase is DryingMaterialStream)
                    {
                        MaterialStreamControl materialOutCtrl = (MaterialStreamControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name);
                        ctrl = new MaterialStreamValuesControl(materialOutCtrl);
                    }
                    ctrl.Location                   = new Point(x, 12 + 20 + 2);
                    this.groupBoxStreams.Size       = new Size(s, this.groupBoxHeight);
                    this.groupBoxFractions.Location = new System.Drawing.Point(this.groupBoxStreams.Width + 4, 24);
                    this.groupBoxStreams.Controls.Add(ctrl);
                    this.Size = new Size(p, this.formHeight);

                    ProsimoUI.SolvableNameTextBox textBoxStreamOutName = new ProsimoUI.SolvableNameTextBox(processStreamBase);
                    textBoxStreamOutName.Width    = 80;
                    textBoxStreamOutName.Height   = 20;
                    textBoxStreamOutName.Text     = processStreamBase.Name;
                    textBoxStreamOutName.Location = new Point(x, 12);
                    this.outletControls.Add(textBoxStreamOutName, textBoxStreamOutName.Text);

                    this.groupBoxStreams.Controls.Add(textBoxStreamOutName);
                    UI.SetStatusColor(textBoxStreamOutName, processStreamBase.SolveState);
                }

                // build the fractions
                for (int i = 0; i < this.TeeCtrl.Tee.OutletStreamAndFractions.Count; i++)
                {
                    StreamAndFraction           sf     = (StreamAndFraction)this.TeeCtrl.Tee.OutletStreamAndFractions[i];
                    TeeStreamAndFractionControl sfCtrl = new TeeStreamAndFractionControl(this.TeeCtrl.Flowsheet, sf);
                    sfCtrl.Location = new Point(0, i * sfCtrl.Height);
                    this.userCtrlFractions.Controls.Add(sfCtrl);
                    sfCtrl.textBoxFraction.KeyUp += new KeyEventHandler(KeyUpNavigator);
                }
            }
            this.Size          = new Size(p + this.groupBoxFractions.Width, this.formHeight);
            this.panel.Visible = true;
        }
Beispiel #2
0
        private void UpdateStreamsUI()
        {
            // clear the streams boxes and start again
            this.groupBoxStreams.Controls.Clear();

            FlashTank flashTank    = this.FlashTankCtrl.FlashTank;
            bool      hasInlet     = false;
            bool      hasVaporOut  = false;
            bool      hasLiquidOut = false;

            ProcessStreamBase inlet = flashTank.Inlet;

            if (inlet != null)
            {
                hasInlet = true;
            }

            ProcessStreamBase vaporOut = flashTank.VaporOutlet;

            if (vaporOut != null)
            {
                hasVaporOut = true;
            }

            ProcessStreamBase liquidOut = flashTank.LiquidOutlet;

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

            if (hasInlet || hasVaporOut || hasLiquidOut)
            {
                ProcessStreamBase labelsStream = null;
                if (hasInlet)
                {
                    labelsStream = inlet;
                }
                else if (hasVaporOut)
                {
                    labelsStream = vaporOut;
                }
                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.groupBoxStreams.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasInlet)
            {
                UserControl ctrl = null;
                if (inlet is ProcessStream)
                {
                    ProcessStreamControl processInCtrl = (ProcessStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.Inlet.Name);
                    ctrl = new ProcessStreamValuesControl(processInCtrl);
                }
                else if (inlet is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = (GasStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.Inlet.Name);
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (inlet is DryingMaterialStream)
                {
                    MaterialStreamControl matInCtrl = (MaterialStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.Inlet.Name);
                    ctrl = new MaterialStreamValuesControl(matInCtrl);
                }
                this.groupBoxStreams.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxInName.SetSolvable(flashTank.Inlet);
                this.groupBoxStreams.Controls.Add(this.textBoxInName);
                this.textBoxInName.Text = flashTank.Inlet.Name;
                UI.SetStatusColor(this.textBoxInName, flashTank.Inlet.SolveState);
            }

            if (hasVaporOut)
            {
                UserControl ctrl = null;
                if (vaporOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.VaporOutlet.Name);
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (vaporOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = (GasStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.VaporOutlet.Name);
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                else if (vaporOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = (MaterialStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.VaporOutlet.Name);
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }
                this.groupBoxStreams.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

                this.textBoxVaporOutName.SetSolvable(flashTank.VaporOutlet);
                this.groupBoxStreams.Controls.Add(this.textBoxVaporOutName);
                this.textBoxVaporOutName.Text = flashTank.VaporOutlet.Name;
                UI.SetStatusColor(this.textBoxVaporOutName, flashTank.VaporOutlet.SolveState);
            }

            if (hasLiquidOut)
            {
                UserControl ctrl = null;
                if (liquidOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.LiquidOutlet.Name);
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (liquidOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = (GasStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.LiquidOutlet.Name);
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                else if (liquidOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = (MaterialStreamControl)this.FlashTankCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.FlashTankCtrl.FlashTank.LiquidOutlet.Name);
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }
                this.groupBoxStreams.Controls.Add(ctrl);
                ctrl.Location = new Point(356, 12 + 20 + 2);

                this.textBoxLiquidOutName.SetSolvable(flashTank.LiquidOutlet);
                this.groupBoxStreams.Controls.Add(this.textBoxLiquidOutName);
                this.textBoxLiquidOutName.Text = flashTank.LiquidOutlet.Name;
                UI.SetStatusColor(this.textBoxLiquidOutName, flashTank.LiquidOutlet.SolveState);
            }
        }
Beispiel #3
0
        private void UpdateStreamsUI()
        {
            // clear the streams boxes and start again
            this.groupBoxMotiveSuction.Controls.Clear();

            Ejector ejector         = this.EjectorCtrl.Ejector;
            bool    hasMotiveIn     = false;
            bool    hasSuctionIn    = false;
            bool    hasDischargeOut = false;

            ProcessStreamBase motiveIn = ejector.MotiveInlet;

            if (motiveIn != null)
            {
                hasMotiveIn = true;
            }

            ProcessStreamBase suctionIn = ejector.SuctionInlet;

            if (suctionIn != null)
            {
                hasSuctionIn = true;
            }

            ProcessStreamBase dischargeOut = ejector.DischargeOutlet;

            if (dischargeOut != null)
            {
                hasDischargeOut = true;
            }

            if (hasMotiveIn || hasSuctionIn || hasDischargeOut)
            {
                ProcessStreamBase labelsStream = null;
                if (hasMotiveIn)
                {
                    labelsStream = motiveIn;
                }
                else if (hasSuctionIn)
                {
                    labelsStream = suctionIn;
                }
                else if (hasDischargeOut)
                {
                    labelsStream = dischargeOut;
                }

                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.groupBoxMotiveSuction.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasMotiveIn)
            {
                UserControl ctrl = null;
                if (motiveIn is ProcessStream)
                {
                    ProcessStreamControl processInCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name);
                    ctrl = new ProcessStreamValuesControl(processInCtrl);
                }
                else if (motiveIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name);
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (motiveIn is DryingMaterialStream)
                {
                    MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name);
                    ctrl = new MaterialStreamValuesControl(materialInCtrl);
                }
                this.groupBoxMotiveSuction.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxMotiveInName.SetSolvable(ejector.MotiveInlet);
                this.groupBoxMotiveSuction.Controls.Add(this.textBoxMotiveInName);
                this.textBoxMotiveInName.Text = ejector.MotiveInlet.Name;
                UI.SetStatusColor(this.textBoxMotiveInName, ejector.MotiveInlet.SolveState);
            }

            if (hasSuctionIn)
            {
                UserControl ctrl = null;
                if (suctionIn is ProcessStream)
                {
                    ProcessStreamControl processInCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name);
                    ctrl = new ProcessStreamValuesControl(processInCtrl);
                }
                else if (suctionIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name);
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (suctionIn is DryingMaterialStream)
                {
                    MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name);
                    ctrl = new MaterialStreamValuesControl(materialInCtrl);
                }
                this.groupBoxMotiveSuction.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

                this.textBoxSuctionInName.SetSolvable(ejector.SuctionInlet);
                this.groupBoxMotiveSuction.Controls.Add(this.textBoxSuctionInName);
                this.textBoxSuctionInName.Text = ejector.SuctionInlet.Name;
                UI.SetStatusColor(this.textBoxSuctionInName, ejector.SuctionInlet.SolveState);
            }

            if (hasDischargeOut)
            {
                UserControl ctrl = null;
                if (dischargeOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name);
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (dischargeOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = (MaterialStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name);
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }
                else if (dischargeOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = (GasStreamControl)this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name);
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                this.groupBoxMotiveSuction.Controls.Add(ctrl);
                ctrl.Location = new Point(356, 12 + 20 + 2);

                this.textBoxDischargeOutName.SetSolvable(ejector.DischargeOutlet);
                this.groupBoxMotiveSuction.Controls.Add(this.textBoxDischargeOutName);
                this.textBoxDischargeOutName.Text = ejector.DischargeOutlet.Name;
                UI.SetStatusColor(this.textBoxDischargeOutName, ejector.DischargeOutlet.SolveState);
            }
        }
Beispiel #4
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);
            }
        }
Beispiel #5
0
        private void UpdateStreamsUI()
        {
            // clear the streams boxes and start again
            this.groupBoxMixtureFluid.Controls.Clear();
            this.groupBoxParticle.Controls.Clear();

            Cyclone cyclone        = this.CycloneCtrl.Cyclone;
            bool    hasGasIn       = false;
            bool    hasGasOut      = false;
            bool    hasParticleOut = false;

            ProcessStreamBase mixtureIn = cyclone.GasInlet;

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

            ProcessStreamBase fluidOut = cyclone.GasOutlet;

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

            ProcessStreamBase particleOut = cyclone.ParticleOutlet;

            if (particleOut != null)
            {
                hasParticleOut = true;
            }

            if (hasGasIn || hasGasOut)
            {
                ProcessStreamBase labelsStream = null;
                if (hasGasIn)
                {
                    labelsStream = mixtureIn;
                }
                else if (hasGasOut)
                {
                    labelsStream = fluidOut;
                }

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

            if (hasGasIn)
            {
                UserControl ctrl = null;
                if (mixtureIn is ProcessStream)
                {
                    ProcessStreamControl processInCtrl = (ProcessStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasInlet.Name);
                    ctrl = new ProcessStreamValuesControl(processInCtrl);
                }
                else if (mixtureIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = (GasStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasInlet.Name);
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                this.groupBoxMixtureFluid.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

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

            if (hasGasOut)
            {
                UserControl ctrl = null;
                if (fluidOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasOutlet.Name);
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (fluidOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = (GasStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasOutlet.Name);
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                this.groupBoxMixtureFluid.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

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

            if (hasParticleOut)
            {
                // add the labels
                UserControl ctrl = null;
                if (particleOut is ProcessStream)
                {
                    ctrl = new ProcessStreamLabelsControl((ProcessStream)particleOut);
                }
                else if (particleOut is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)particleOut);
                }
                this.groupBoxParticle.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);

                // add the values
                ctrl = null;
                if (particleOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.ParticleOutlet.Name);
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (particleOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = (MaterialStreamControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.ParticleOutlet.Name);
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }
                this.groupBoxParticle.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxParticleOutName.SetSolvable(cyclone.ParticleOutlet);
                this.groupBoxParticle.Controls.Add(this.textBoxParticleOutName);
                this.textBoxParticleOutName.Text = cyclone.ParticleOutlet.Name;
                UI.SetStatusColor(this.textBoxParticleOutName, cyclone.ParticleOutlet.SolveState);
            }
        }
Beispiel #6
0
        private void UpdateUI()
        {
            this.panel.Visible    = false;
            this.groupBox.Visible = false;
            this.groupBox.Controls.Clear();
            this.inletControls.Clear();
            int x = INITIAL_LOCATION;
            int w = VALUE_WIDTH;
            int s = INITIAL_GROUPBOX_WIDTH;
            int p = INITIAL_FORM_WIDTH;

            Mixer mixer        = this.MixerCtrl.Mixer;
            bool  hasStreamIn  = false;
            bool  hasStreamOut = false;

            ProcessStreamBase streamIn = null;

            if (mixer.InletStreams.Count > 0)
            {
                hasStreamIn = true;
                streamIn    = (ProcessStreamBase)mixer.InletStreams[0];
            }

            ProcessStreamBase streamOut = mixer.Outlet;

            if (streamOut != null)
            {
                hasStreamOut = true;
            }

            if (hasStreamIn || hasStreamOut)
            {
                this.groupBox.Visible = true;
                ProcessStreamBase labelsStream = null;
                if (hasStreamIn)
                {
                    labelsStream = streamIn;
                }
                else if (hasStreamOut)
                {
                    labelsStream = streamOut;
                }

                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);
                }
                ctrl.Location      = new Point(4, 12 + 20 + 2);
                this.groupBox.Size = new Size(s, this.groupBoxHeight);
                this.groupBox.Controls.Add(ctrl);
                this.Size = new Size(p, this.formHeight);
                s         = s + w;
                p         = p + w;
            }

            if (hasStreamIn)
            {
                IEnumerator e = mixer.InletStreams.GetEnumerator();
                while (e.MoveNext())
                {
                    ProcessStreamBase processStreamBase = (ProcessStreamBase)e.Current;
                    UserControl       ctrl = null;
                    if (processStreamBase is ProcessStream)
                    {
                        ProcessStreamControl processInCtrl = (ProcessStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name);
                        ctrl = new ProcessStreamValuesControl(processInCtrl);
                    }
                    else if (processStreamBase is DryingGasStream)
                    {
                        GasStreamControl gasInCtrl = (GasStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name);
                        ctrl = new GasStreamValuesControl(gasInCtrl);
                    }
                    else if (processStreamBase is DryingMaterialStream)
                    {
                        MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name);
                        ctrl = new MaterialStreamValuesControl(materialInCtrl);
                    }
                    ctrl.Location      = new Point(x, 12 + 20 + 2);
                    this.groupBox.Size = new Size(s, this.groupBoxHeight);
                    this.groupBox.Controls.Add(ctrl);
                    this.Size = new Size(p, this.formHeight);

                    ProsimoUI.SolvableNameTextBox textBoxStreamInName = new ProsimoUI.SolvableNameTextBox(processStreamBase);
                    textBoxStreamInName.Width    = 80;
                    textBoxStreamInName.Height   = 20;
                    textBoxStreamInName.Text     = processStreamBase.Name;
                    textBoxStreamInName.Location = new Point(x, 12);
                    this.inletControls.Add(textBoxStreamInName, textBoxStreamInName.Text);

                    this.groupBox.Controls.Add(textBoxStreamInName);
                    UI.SetStatusColor(textBoxStreamInName, processStreamBase.SolveState);

                    s = s + w;
                    x = x + w;
                    p = p + w;
                }
            }

            if (hasStreamOut)
            {
                UserControl ctrl = null;
                if (streamOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamOut.Name);
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (streamOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = (GasStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamOut.Name);
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                else if (streamOut is DryingMaterialStream)
                {
                    MaterialStreamControl materialOutCtrl = (MaterialStreamControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamOut.Name);
                    ctrl = new MaterialStreamValuesControl(materialOutCtrl);
                }
                ctrl.Location      = new Point(x, 12 + 20 + 2);
                this.groupBox.Size = new Size(s, this.groupBoxHeight);
                this.groupBox.Controls.Add(ctrl);
                this.Size = new Size(p, this.formHeight);

                textBoxStreamOutName.Text     = streamOut.Name;
                textBoxStreamOutName.Location = new Point(x, 12);

                this.textBoxStreamOutName.SetSolvable(streamOut);
                this.groupBox.Controls.Add(this.textBoxStreamOutName);
                UI.SetStatusColor(this.textBoxStreamOutName, streamOut.SolveState);
            }
            this.panel.Visible = true;
        }
Beispiel #7
0
        private void UpdateStreamsUI()
        {
            // clear the streams boxes and start again
            this.groupBoxStreams.Controls.Clear();
            TwoStreamUnitOperation twoStreamUnitOp = this.TwoStreamUnitOpCtrl.TwoStreamUnitOp;
            bool hasStreamIn  = false;
            bool hasStreamOut = false;

            ProcessStreamBase streamIn = twoStreamUnitOp.Inlet;

            if (streamIn != null)
            {
                hasStreamIn = true;
            }

            ProcessStreamBase streamOut = twoStreamUnitOp.Outlet;

            if (streamOut != null)
            {
                hasStreamOut = true;
            }

            if (hasStreamIn || hasStreamOut)
            {
                ProcessStreamBase labelsStream = null;
                if (hasStreamIn)
                {
                    labelsStream = streamIn;
                }
                else if (hasStreamOut)
                {
                    labelsStream = streamOut;
                }

                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.groupBoxStreams.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasStreamIn)
            {
                UserControl ctrl = null;
                if (streamIn is ProcessStream)
                {
                    ProcessStreamControl processInCtrl = (ProcessStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name);
                    ctrl = new ProcessStreamValuesControl(processInCtrl);
                }
                else if (streamIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = (GasStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name);
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (streamIn is DryingMaterialStream)
                {
                    MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name);
                    ctrl = new MaterialStreamValuesControl(materialInCtrl);
                }
                this.groupBoxStreams.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxStreamInName.SetSolvable(streamIn);
                this.groupBoxStreams.Controls.Add(this.textBoxStreamInName);
                this.textBoxStreamInName.Text = twoStreamUnitOp.Inlet.Name;
                UI.SetStatusColor(this.textBoxStreamInName, twoStreamUnitOp.Inlet.SolveState);
            }

            if (hasStreamOut)
            {
                UserControl ctrl = null;
                if (streamOut is ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = (ProcessStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name);
                    ctrl = new ProcessStreamValuesControl(processOutCtrl);
                }
                else if (streamOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = (GasStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name);
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                else if (streamOut is DryingMaterialStream)
                {
                    MaterialStreamControl materialOutCtrl = (MaterialStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name);
                    ctrl = new MaterialStreamValuesControl(materialOutCtrl);
                }
                this.groupBoxStreams.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

                this.textBoxStreamOutName.SetSolvable(streamOut);
                this.groupBoxStreams.Controls.Add(this.textBoxStreamOutName);
                this.textBoxStreamOutName.Text = twoStreamUnitOp.Outlet.Name;
                UI.SetStatusColor(this.textBoxStreamOutName, twoStreamUnitOp.Outlet.SolveState);
            }
        }