Exemplo n.º 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;
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 6
0
        private void UpdateStreamsUI()
        {
            // clear the stream group-boxes and start again
            this.groupBoxDryingMedium.Controls.Clear();
            this.groupBoxMaterial.Controls.Clear();
            Dryer dryer = this.DryerCtrl.Dryer;

            bool hasGasIn       = false;
            bool hasGasOut      = false;
            bool hasMaterialIn  = false;
            bool hasMaterialOut = false;

            DryingGasStream gasIn = dryer.GasInlet;

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

            DryingGasStream gasOut = dryer.GasOutlet;

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

            DryingMaterialStream materialIn = dryer.MaterialInlet;

            if (materialIn != null)
            {
                hasMaterialIn = true;
            }

            DryingMaterialStream materialOut = dryer.MaterialOutlet;

            if (materialOut != null)
            {
                hasMaterialOut = true;
            }

            if (hasGasIn || hasGasOut)
            {
                DryingGasStream labelsStream = null;
                if (hasGasIn)
                {
                    labelsStream = gasIn;
                }
                else if (hasGasOut)
                {
                    labelsStream = gasOut;
                }
                gasLabelsCtrl = new GasStreamLabelsControl(labelsStream);
                this.groupBoxDryingMedium.Controls.Add(gasLabelsCtrl);
                gasLabelsCtrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasGasIn)
            {
                GasStreamControl gasInCtrl = (GasStreamControl)this.DryerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.DryerCtrl.Dryer.GasInlet.Name);
                gasValuesInCtrl = new GasStreamValuesControl(gasInCtrl);
                this.groupBoxDryingMedium.Controls.Add(gasValuesInCtrl);
                gasValuesInCtrl.Location = new Point(196, 12 + 20 + 2);

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

            if (hasGasOut)
            {
                GasStreamControl gasOutCtrl = (GasStreamControl)this.DryerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.DryerCtrl.Dryer.GasOutlet.Name);
                gasValuesOutCtrl = new GasStreamValuesControl(gasOutCtrl);
                this.groupBoxDryingMedium.Controls.Add(gasValuesOutCtrl);
                gasValuesOutCtrl.Location = new Point(276, 12 + 20 + 2);

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

            if (hasMaterialIn || hasMaterialOut)
            {
                DryingMaterialStream labelsStream = null;
                if (hasMaterialIn)
                {
                    labelsStream = materialIn;
                }
                else if (hasMaterialOut)
                {
                    labelsStream = materialOut;
                }
                materialLabelsCtrl = new MaterialStreamLabelsControl(labelsStream);
                this.groupBoxMaterial.Controls.Add(materialLabelsCtrl);
                materialLabelsCtrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasMaterialIn)
            {
                MaterialStreamControl materialInCtrl = (MaterialStreamControl)this.DryerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.DryerCtrl.Dryer.MaterialInlet.Name);
                materialValuesInCtrl = new MaterialStreamValuesControl(materialInCtrl);
                this.groupBoxMaterial.Controls.Add(materialValuesInCtrl);
                materialValuesInCtrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxMaterialInName.SetSolvable(dryer.MaterialInlet);
                this.groupBoxMaterial.Controls.Add(this.textBoxMaterialInName);
                this.textBoxMaterialInName.Text = dryer.MaterialInlet.Name;
                UI.SetStatusColor(this.textBoxMaterialInName, dryer.MaterialInlet.SolveState);
            }

            if (hasMaterialOut)
            {
                MaterialStreamControl materialOutCtrl = (MaterialStreamControl)this.DryerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.DryerCtrl.Dryer.MaterialOutlet.Name);
                materialValuesOutCtrl = new MaterialStreamValuesControl(materialOutCtrl);
                this.groupBoxMaterial.Controls.Add(materialValuesOutCtrl);
                materialValuesOutCtrl.Location = new Point(276, 12 + 20 + 2);

                this.textBoxMaterialOutName.SetSolvable(dryer.MaterialOutlet);
                this.groupBoxMaterial.Controls.Add(this.textBoxMaterialOutName);
                this.textBoxMaterialOutName.Text = dryer.MaterialOutlet.Name;
                UI.SetStatusColor(this.textBoxMaterialOutName, dryer.MaterialOutlet.SolveState);
            }
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 9
0
        private ArrayList GetFlowsheetContent(Flowsheet flowsheet)
        {
            ArrayList toSerializeItems = new ArrayList();

            toSerializeItems.Add(flowsheet.EvaporationAndDryingSystem);

            // get all the flowsheet element controls
            IEnumerator e = flowsheet.Controls.GetEnumerator();

            while (e.MoveNext())
            {
                object obj = e.Current;
                if (obj is GasStreamControl)
                {
                    GasStreamControl ctrl = (GasStreamControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is MaterialStreamControl)
                {
                    MaterialStreamControl ctrl = (MaterialStreamControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is DryerControl)
                {
                    DryerControl ctrl = (DryerControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is HeatExchangerControl)
                {
                    HeatExchangerControl ctrl = (HeatExchangerControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is CycloneControl)
                {
                    CycloneControl ctrl = (CycloneControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is EjectorControl)
                {
                    EjectorControl ctrl = (EjectorControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is WetScrubberControl)
                {
                    WetScrubberControl ctrl = (WetScrubberControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is ScrubberCondenserControl)
                {
                    ScrubberCondenserControl ctrl = (ScrubberCondenserControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is MixerControl)
                {
                    MixerControl ctrl = (MixerControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is TeeControl)
                {
                    TeeControl ctrl = (TeeControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is FlashTankControl)
                {
                    FlashTankControl ctrl = (FlashTankControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is FanControl)
                {
                    FanControl ctrl = (FanControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is ValveControl)
                {
                    ValveControl ctrl = (ValveControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is BagFilterControl)
                {
                    BagFilterControl ctrl = (BagFilterControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is AirFilterControl)
                {
                    AirFilterControl ctrl = (AirFilterControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is CompressorControl)
                {
                    CompressorControl ctrl = (CompressorControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is HeaterControl)
                {
                    HeaterControl ctrl = (HeaterControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is CoolerControl)
                {
                    CoolerControl ctrl = (CoolerControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is ElectrostaticPrecipitatorControl)
                {
                    ElectrostaticPrecipitatorControl ctrl = (ElectrostaticPrecipitatorControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is PumpControl)
                {
                    PumpControl ctrl = (PumpControl)obj;
                    toSerializeItems.Add(ctrl);
                }
                else if (obj is RecycleControl)
                {
                    RecycleControl ctrl = (RecycleControl)obj;
                    toSerializeItems.Add(ctrl);
                }
            }

            // get all the connections
            e = flowsheet.ConnectionManager.Connections.GetEnumerator();
            while (e.MoveNext())
            {
                SolvableConnection dc = (SolvableConnection)e.Current;
                toSerializeItems.Add(dc);
            }

            // get the flowsheet preferences
            FlowsheetPreferences flowsheetPrefs = new FlowsheetPreferences(flowsheet);

            toSerializeItems.Add(flowsheetPrefs);

            // get the custom editor (we persist only the ID of the variables)
            toSerializeItems.Add(flowsheet.CustomEditor);

            // get the flowsheet version
            toSerializeItems.Add(flowsheet.Version);

            return(toSerializeItems);
        }
Exemplo n.º 10
0
        private void UpdateStreamsUI()
        {
            // clear the stream group-boxes and start again
            this.groupBoxColdStream.Controls.Clear();
            this.groupBoxHotStream.Controls.Clear();

            HeatExchanger heatExchanger = this.HeatExchangerCtrl.HeatExchanger;
            bool          hasColdIn     = false;
            bool          hasColdOut    = false;
            bool          hasHotIn      = false;
            bool          hasHotOut     = false;

            ProcessStreamBase coldIn = heatExchanger.ColdSideInlet;

            hasColdIn = coldIn != null;

            ProcessStreamBase coldOut = heatExchanger.ColdSideOutlet;

            hasColdOut = coldOut != null;

            ProcessStreamBase hotIn = heatExchanger.HotSideInlet;

            hasHotIn = hotIn != null;

            ProcessStreamBase hotOut = heatExchanger.HotSideOutlet;

            hasHotOut = hotOut != null;

            if (hasColdIn || hasColdOut)
            {
                ProcessStreamBase labelsStream = hasColdIn ? coldIn : coldOut;

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

            if (hasColdIn)
            {
                UserControl ctrl = null;
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideInlet.Name);
                if (coldIn is WaterStream)
                {
                    WaterStreamControl processInCtrl = baseCtrl as WaterStreamControl;
                    ctrl = new ProcessVarValuesControl(processInCtrl);
                }
                else if (coldIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (coldIn is DryingMaterialStream)
                {
                    MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matInCtrl);
                }

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

                this.textBoxColdInName.SetSolvable(heatExchanger.ColdSideInlet);
                this.groupBoxColdStream.Controls.Add(this.textBoxColdInName);
                this.textBoxColdInName.Text = heatExchanger.ColdSideInlet.Name;
                UI.SetStatusColor(this.textBoxColdInName, heatExchanger.ColdSideInlet.SolveState);
            }

            if (hasColdOut)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideOutlet.Name);
                UserControl ctrl = null;
                if (coldOut is WaterStream)
                {
                    WaterStreamControl processOutCtrl = baseCtrl as WaterStreamControl;
                    ctrl = new ProcessVarValuesControl(processOutCtrl);
                }
                else if (coldOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                else if (coldOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }
                this.groupBoxColdStream.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

                this.textBoxColdOutName.SetSolvable(heatExchanger.ColdSideOutlet);
                this.groupBoxColdStream.Controls.Add(this.textBoxColdOutName);
                this.textBoxColdOutName.Text = heatExchanger.ColdSideOutlet.Name;
                UI.SetStatusColor(this.textBoxColdOutName, heatExchanger.ColdSideOutlet.SolveState);
            }

            if (hasHotIn || hasHotOut)
            {
                ProcessStreamBase labelsStream = hasHotIn ? hotIn : hotOut;

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

            if (hasHotIn)
            {
                UserControl ctrl = null;
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideInlet.Name);
                if (hotIn is WaterStream)
                {
                    WaterStreamControl processInCtrl = baseCtrl as WaterStreamControl;
                    ctrl = new ProcessVarValuesControl(processInCtrl);
                }
                else if (hotIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }
                else if (hotIn is DryingMaterialStream)
                {
                    MaterialStreamControl matInCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matInCtrl);
                }

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

                this.textBoxHotInName.SetSolvable(heatExchanger.HotSideInlet);
                this.groupBoxHotStream.Controls.Add(this.textBoxHotInName);
                this.textBoxHotInName.Text = heatExchanger.HotSideInlet.Name;
                UI.SetStatusColor(this.textBoxHotInName, heatExchanger.HotSideInlet.SolveState);
            }

            if (hasHotOut)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideOutlet.Name);
                UserControl ctrl = null;
                if (hotOut is WaterStream)
                {
                    WaterStreamControl processOutCtrl = baseCtrl as WaterStreamControl;
                    ctrl = new ProcessVarValuesControl(processOutCtrl);
                }
                else if (hotOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                else if (hotOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }
                this.groupBoxHotStream.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

                this.textBoxHotOutName.SetSolvable(heatExchanger.HotSideOutlet);
                this.groupBoxHotStream.Controls.Add(this.textBoxHotOutName);
                this.textBoxHotOutName.Text = heatExchanger.HotSideOutlet.Name;
                UI.SetStatusColor(this.textBoxHotOutName, heatExchanger.HotSideOutlet.SolveState);
            }
        }
Exemplo n.º 11
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;

            hasStreamIn = streamIn != null;

            ProcessStreamBase streamOut = twoStreamUnitOp.Outlet;

            hasStreamOut = streamOut != null;

            if (hasStreamIn || hasStreamOut)
            {
                ProcessStreamBase labelsStream = hasStreamIn ? streamIn : streamOut;
                UserControl       ctrl         = null;
                if (labelsStream is WaterStream)
                {
                    ctrl = new ProcessVarLabelsControl(labelsStream.VarList);
                }
                else if (labelsStream is DryingGasStream)
                {
                    ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream);
                }
                else if (labelsStream is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream);
                }

                //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList);

                this.groupBoxStreams.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasStreamIn)
            {
                ProcessStreamBaseControl myControl = this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name);
                UserControl ctrl = null;
                if (streamIn is WaterStream)
                {
                    WaterStreamControl processInCtrl = (WaterStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name);
                    ctrl = new ProcessVarValuesControl(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);
                }

                //UserControl ctrl = new ProcessVarValuesControl(myControl);

                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)
            {
                ProcessStreamBaseControl baseControl = this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name);
                UserControl ctrl = null;
                if (streamOut is WaterStream)
                {
                    WaterStreamControl processOutCtrl = (WaterStreamControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name);
                    ctrl = new ProcessVarValuesControl(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);
                }
                //UserControl ctrl = new ProcessVarValuesControl(baseControl);

                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);
            }
        }