Пример #1
0
        private void UpdateStreamsUI()
        {
            // clear the streams boxes and start again
            this.groupBoxGasInletOutlet.Controls.Clear();
            this.groupBoxLiquidOutlet.Controls.Clear();
            this.groupBoxWaterInletOutlet.Controls.Clear();

            ScrubberCondenser scrubberCondenser = this.ScrubberCondenserCtrl.ScrubberCondenser;
            bool hasGasIn     = false;
            bool hasGasOut    = false;
            bool hasLiquidOut = false;
            bool hasWaterIn   = false;
            bool hasWaterOut  = false;

            ProcessStreamBase gasIn = scrubberCondenser.GasInlet;

            hasGasIn = gasIn != null;

            ProcessStreamBase gasOut = scrubberCondenser.GasOutlet;

            hasGasOut = gasOut != null;

            ProcessStreamBase liquidOut = scrubberCondenser.LiquidOutlet;

            hasLiquidOut = liquidOut != null;

            ProcessStreamBase waterIn = scrubberCondenser.WaterInlet;

            hasWaterIn = waterIn != null;

            ProcessStreamBase waterOut = scrubberCondenser.WaterOutlet;

            hasWaterOut = waterOut != null;

            if (hasGasIn || hasGasOut)
            {
                ProcessStreamBase labelsStream = hasGasIn ? gasIn : gasOut;

                //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList);
                UserControl ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream);
                this.groupBoxGasInletOutlet.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);
            }

            if (hasGasIn)
            {
                ProcessStreamBaseControl gasInCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasInlet.Name);
                //UserControl ctrl = new ProcessVarValuesControl(gasInCtrl);
                UserControl ctrl = new GasStreamValuesControl((GasStreamControl)gasInCtrl);

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

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

            if (hasGasOut)
            {
                ProcessStreamBaseControl gasOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.GasOutlet.Name);
                //UserControl ctrl = new ProcessVarValuesControl(gasOutCtrl);
                UserControl ctrl = new GasStreamValuesControl((GasStreamControl)gasOutCtrl);
                this.groupBoxGasInletOutlet.Controls.Add(ctrl);
                ctrl.Location = new Point(276, 12 + 20 + 2);

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

            if (hasLiquidOut)
            {
                // add the labels
                //UserControl ctrl = new ProcessVarLabelsControl(liquidOut.VarList);
                UserControl ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)liquidOut);
                this.groupBoxLiquidOutlet.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);

                ProcessStreamBaseControl matOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.LiquidOutlet.Name);
                //ctrl = new ProcessVarValuesControl(matOutCtrl);
                ctrl = new MaterialStreamValuesControl((MaterialStreamControl)matOutCtrl);
                this.groupBoxLiquidOutlet.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxLiquidOutName.SetSolvable(scrubberCondenser.LiquidOutlet);
                this.groupBoxLiquidOutlet.Controls.Add(this.textBoxLiquidOutName);
                this.textBoxLiquidOutName.Text = scrubberCondenser.LiquidOutlet.Name;
                UI.SetStatusColor(this.textBoxLiquidOutName, scrubberCondenser.LiquidOutlet.SolveState);
            }

            if (hasWaterIn || hasWaterOut)
            {
                UserControl       ctrl         = null;
                ProcessStreamBase labelsStream = hasWaterIn ? waterIn : waterOut;
                if (waterIn is WaterStream)
                {
                    ctrl = new ProcessVarLabelsControl(labelsStream.VarList);
                }
                else if (waterIn is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream);
                }

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

            if (hasWaterIn)
            {
                UserControl ctrl = null;
                ProcessStreamBaseControl waterInCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.WaterInlet.Name);
                if (waterIn is WaterStream)
                {
                    ctrl = new ProcessVarValuesControl(waterInCtrl);
                }
                else if (waterIn is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamValuesControl((MaterialStreamControl)waterInCtrl);
                }
                this.groupBoxWaterInletOutlet.Controls.Add(ctrl);
                ctrl.Location = new Point(196, 12 + 20 + 2);

                this.textBoxWaterInName.SetSolvable(scrubberCondenser.WaterInlet);
                this.groupBoxWaterInletOutlet.Controls.Add(this.textBoxWaterInName);
                this.textBoxWaterInName.Text = scrubberCondenser.WaterInlet.Name;
                UI.SetStatusColor(this.textBoxWaterInName, scrubberCondenser.WaterInlet.SolveState);
            }

            if (hasWaterOut)
            {
                UserControl ctrl = null;
                ProcessStreamBaseControl waterOutCtrl = this.ScrubberCondenserCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.ScrubberCondenserCtrl.ScrubberCondenser.WaterOutlet.Name);
                if (waterOut is WaterStream)
                {
                    ctrl = new ProcessVarValuesControl(waterOutCtrl);
                }
                else if (waterOut is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamValuesControl((MaterialStreamControl)waterOutCtrl);
                }

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

                this.textBoxWaterOutName.SetSolvable(scrubberCondenser.WaterOutlet);
                this.groupBoxWaterInletOutlet.Controls.Add(this.textBoxWaterOutName);
                this.textBoxWaterOutName.Text = scrubberCondenser.WaterOutlet.Name;
                UI.SetStatusColor(this.textBoxWaterOutName, scrubberCondenser.WaterOutlet.SolveState);
            }
        }
Пример #2
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;

            if (coldIn != null)
            {
                hasColdIn = true;
            }

            ProcessStreamBase coldOut = heatExchanger.ColdSideOutlet;

            if (coldOut != null)
            {
                hasColdOut = true;
            }

            ProcessStreamBase hotIn = heatExchanger.HotSideInlet;

            if (hotIn != null)
            {
                hasHotIn = true;
            }

            ProcessStreamBase hotOut = heatExchanger.HotSideOutlet;

            if (hotOut != null)
            {
                hasHotOut = true;
            }

            if (hasColdIn || hasColdOut)
            {
                ProcessStreamBase labelsStream = null;
                if (hasColdIn)
                {
                    labelsStream = coldIn;
                }
                else if (hasColdOut)
                {
                    labelsStream = coldOut;
                }

                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.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 ProcessStream)
                {
                    ProcessStreamControl processInCtrl = baseCtrl as ProcessStreamControl;
                    ctrl = new ProcessStreamValuesControl(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 ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = baseCtrl as ProcessStreamControl;
                    ctrl = new ProcessStreamValuesControl(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 = null;
                if (hasHotIn)
                {
                    labelsStream = hotIn;
                }
                else if (hasHotOut)
                {
                    labelsStream = hotOut;
                }

                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.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 ProcessStream)
                {
                    ProcessStreamControl processInCtrl = baseCtrl as ProcessStreamControl;
                    ctrl = new ProcessStreamValuesControl(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 ProcessStream)
                {
                    ProcessStreamControl processOutCtrl = baseCtrl as ProcessStreamControl;
                    ctrl = new ProcessStreamValuesControl(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);
            }
        }
Пример #3
0
        protected override void MouseDownHandler(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestMotiveIn(p) || HitTestSuctionIn(p) || HitTestDischargeOut(p))
                {
                    if (HitTestMotiveIn(p))
                    {
                        idx = Ejector.MOTIVE_INLET_INDEX;
                    }
                    else if (HitTestSuctionIn(p))
                    {
                        idx = Ejector.SUCTION_INLET_INDEX;
                    }
                    else if (HitTestDischargeOut(p))
                    {
                        idx = Ejector.DISCHARGE_OUTLET_INDEX;
                    }

                    if (this.Ejector.CanAttach(idx))
                    {
                        // ok for the second step
                        this.flowsheet.firstStepCtrl = this;
                        this.flowsheet.SetFlowsheetActivity(FlowsheetActivity.AddingConnStepTwo);
                        this.flowsheet.attachIndex = idx;
                    }
                }
                else
                {
                    this.flowsheet.ResetActivity();
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestMotiveIn(p))
                    {
                        idx = Ejector.MOTIVE_INLET_INDEX;
                    }
                    else if (HitTestSuctionIn(p))
                    {
                        idx = Ejector.SUCTION_INLET_INDEX;
                    }
                    else if (HitTestDischargeOut(p))
                    {
                        idx = Ejector.DISCHARGE_OUTLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.Ejector.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        // update the model, the UI will be updated in the listener
                        ErrorMessage error = this.Ejector.AttachStream(ctrl.ProcessStreamBase, idx);
                        UI.ShowError(error);
                    }
                }
                this.flowsheet.ResetActivity();
            }
            else
            {
                this.flowsheet.ResetActivity();
                this.PerformSelection();
                this.PrepareForTheMove(p.X, p.Y);
            }
        }
Пример #4
0
        public override void CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad)
        {
            StreamType streamType = StreamType.Unknown;

            if (ps is DryingGasStream)
            {
                streamType = StreamType.Gas;
            }
            else if (ps is ProcessStream)
            {
                streamType = StreamType.Process;
            }
            else if (ps is DryingMaterialStream)
            {
                streamType = StreamType.Material;
            }

            ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps);
            SolvableConnection       conn = null;

            if (ad == ScrubberCondenser.GAS_INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ScrubberCondenser.GAS_INLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetGasInConnectionPoint();
                PointOrientation uoOrientation = ScrubberCondenserControl.GAS_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }
            else if (ad == ScrubberCondenser.GAS_OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ScrubberCondenser.GAS_OUTLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetGasOutConnectionPoint();
                PointOrientation uoOrientation = ScrubberCondenserControl.GAS_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }
            else if (ad == ScrubberCondenser.LIQUID_OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ScrubberCondenser.LIQUID_OUTLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetLiquidOutConnectionPoint();
                PointOrientation uoOrientation = ScrubberCondenserControl.LIQUID_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }

            if (conn != null)
            {
                this.flowsheet.ConnectionManager.Connections.Add(conn);
                this.flowsheet.ConnectionManager.DrawConnections();
            }
        }
Пример #5
0
        protected override void MouseDownHandler(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestGasIn(p) || HitTestGasOut(p) || HitTestLiquidOut(p))
                {
                    if (HitTestGasIn(p))
                    {
                        idx = ScrubberCondenser.GAS_INLET_INDEX;
                    }
                    else if (HitTestGasOut(p))
                    {
                        idx = ScrubberCondenser.GAS_OUTLET_INDEX;
                    }
                    else if (HitTestLiquidOut(p))
                    {
                        idx = ScrubberCondenser.LIQUID_OUTLET_INDEX;
                    }

                    if (this.ScrubberCondenser.CanConnect(idx))
                    {
                        // ok for the second step
                        this.flowsheet.firstStepCtrl = this;
                        this.flowsheet.Activity      = FlowsheetActivity.AddingConnStepTwo;
                        this.flowsheet.attachIndex   = idx;
                    }
                }
                else
                {
                    this.flowsheet.ResetActivity();
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestGasIn(p))
                    {
                        idx = ScrubberCondenser.GAS_INLET_INDEX;
                    }
                    else if (HitTestGasOut(p))
                    {
                        idx = ScrubberCondenser.GAS_OUTLET_INDEX;
                    }
                    else if (HitTestLiquidOut(p))
                    {
                        idx = ScrubberCondenser.LIQUID_OUTLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.ScrubberCondenser.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        // update the model, the UI will be updated in the listener
                        ErrorMessage error = this.ScrubberCondenser.AttachStream(ctrl.ProcessStreamBase, idx);
                        UI.ShowError(error);
                    }
                }
                this.flowsheet.ResetActivity();
            }
            else
            {
                this.flowsheet.ResetActivity();
                this.PerformSelection();
                this.PrepareForTheMove(p.X, p.Y);
            }
        }
Пример #6
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;

            hasGasIn = mixtureIn != null;

            ProcessStreamBase fluidOut = cyclone.GasOutlet;

            hasGasOut = fluidOut != null;

            ProcessStreamBase particleOut = cyclone.ParticleOutlet;

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

            if (hasGasIn || hasGasOut)
            {
                ProcessStreamBase labelsStream = hasGasIn ? mixtureIn : fluidOut;

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

            if (hasGasIn)
            {
                ProcessStreamBaseControl gasInCtrl = this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasInlet.Name);
                //UserControl ctrl = new ProcessVarValuesControl(gasInCtrl);
                UserControl ctrl = new GasStreamValuesControl((GasStreamControl)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)
            {
                ProcessStreamBaseControl gasOutCtrl = this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasOutlet.Name);
                //UserControl ctrl = new ProcessVarValuesControl(gasOutCtrl);
                UserControl ctrl = new GasStreamValuesControl((GasStreamControl)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 DryingMaterialStream)
                {
                    ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)particleOut);
                    //ctrl = new ProcessVarLabelsControl(particleOut.VarList);
                }
                this.groupBoxParticle.Controls.Add(ctrl);
                ctrl.Location = new Point(4, 12 + 20 + 2);

                // add the values
                ProcessStreamBaseControl matOutCtrl = this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.ParticleOutlet.Name);
                if (particleOut is DryingMaterialStream)
                {
                    //ctrl = new ProcessVarValuesControl(matOutCtrl);
                    ctrl = new MaterialStreamValuesControl((MaterialStreamControl)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);
            }
        }
Пример #7
0
        protected override void ShowConnectionPoints(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestColdIn(p) || HitTestColdOut(p) || HitTestHotIn(p) || HitTestHotOut(p))
                {
                    if (HitTestColdIn(p))
                    {
                        idx = HeatExchanger.COLD_SIDE_INLET_INDEX;
                    }
                    else if (HitTestColdOut(p))
                    {
                        idx = HeatExchanger.COLD_SIDE_OUTLET_INDEX;
                    }
                    else if (HitTestHotIn(p))
                    {
                        idx = HeatExchanger.HOT_SIDE_INLET_INDEX;
                    }
                    else if (HitTestHotOut(p))
                    {
                        idx = HeatExchanger.HOT_SIDE_OUTLET_INDEX;
                    }

                    if (this.HeatExchanger.CanConnect(idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestColdIn(p))
                    {
                        idx = HeatExchanger.COLD_SIDE_INLET_INDEX;
                    }
                    else if (HitTestColdOut(p))
                    {
                        idx = HeatExchanger.COLD_SIDE_OUTLET_INDEX;
                    }
                    else if (HitTestHotIn(p))
                    {
                        idx = HeatExchanger.HOT_SIDE_INLET_INDEX;
                    }
                    else if (HitTestHotOut(p))
                    {
                        idx = HeatExchanger.HOT_SIDE_OUTLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.HeatExchanger.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #8
0
        private void UpdateStreamUI()
        {
            //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;
            Boolean           bFirstControl = true;

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

            if (hasStreamIn)
            {
                IEnumerator e = mixer.InletStreams.GetEnumerator();
                while (e.MoveNext())
                {
                    ProcessStreamBase        processStreamBase = (ProcessStreamBase)e.Current;
                    ProcessStreamBaseControl processInCtrl     = (ProcessStreamBaseControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name);
                    if (bFirstControl)
                    {
                        initializeGrid(processInCtrl, columnIndex, false, "Inlet/Outlet");
                        columnIndex  += 2;
                        bFirstControl = false;
                    }
                    else
                    {
                        initializeGrid(processInCtrl, columnIndex, true, "Inlet/Outlet");
                        columnIndex++;
                    }
                    //this.groupBox.Controls.Add(textBoxStreamInName);
                    //UI.SetStatusColor(textBoxStreamInName, processStreamBase.SolveState);
                }
            }

            if (hasStreamOut)
            {
                ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.MixerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamOut.Name);
                if (bFirstControl)
                {
                    initializeGrid(processOutCtrl, columnIndex, false, "Inlet/Outlet");
                    columnIndex  += 2;
                    bFirstControl = false;
                }
                else
                {
                    initializeGrid(processOutCtrl, columnIndex, true, "Inlet/Outlet");
                    columnIndex++;
                }
                //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.statusBar, streamOut.BSolveState);
            }
            //this.panel.Visible = true;
        }
Пример #9
0
 protected override UserControl GetNewStreamValuesControl(ProcessStreamBaseControl streamCtrl)
 {
     return(new GasStreamValuesControl((GasStreamControl)streamCtrl));
 }
Пример #10
0
        protected override void ShowConnectionPoints(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestMotiveIn(p) || HitTestSuctionIn(p) || HitTestDischargeOut(p))
                {
                    if (HitTestMotiveIn(p))
                    {
                        idx = Ejector.MOTIVE_INLET_INDEX;
                    }
                    else if (HitTestSuctionIn(p))
                    {
                        idx = Ejector.SUCTION_INLET_INDEX;
                    }
                    else if (HitTestDischargeOut(p))
                    {
                        idx = Ejector.DISCHARGE_OUTLET_INDEX;
                    }

                    if (this.Ejector.CanConnect(idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestMotiveIn(p))
                    {
                        idx = Ejector.MOTIVE_INLET_INDEX;
                    }
                    else if (HitTestSuctionIn(p))
                    {
                        idx = Ejector.SUCTION_INLET_INDEX;
                    }
                    else if (HitTestDischargeOut(p))
                    {
                        idx = Ejector.DISCHARGE_OUTLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.Ejector.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #11
0
        public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad)
        {
            ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps);
            SolvableConnection       conn = null;

            if (ad == ScrubberCondenser.GAS_INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ScrubberCondenser.GAS_INLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetGasInConnectionPoint();
                PointOrientation uoOrientation = ScrubberCondenserControl.GAS_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == ScrubberCondenser.GAS_OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ScrubberCondenser.GAS_OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetGasOutConnectionPoint();
                PointOrientation uoOrientation = ScrubberCondenserControl.GAS_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == ScrubberCondenser.LIQUID_OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ScrubberCondenser.LIQUID_OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetLiquidOutConnectionPoint();
                PointOrientation uoOrientation = ScrubberCondenserControl.LIQUID_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == ScrubberCondenser.WATER_INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ScrubberCondenser.WATER_INLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetWaterInConnectionPoint();
                PointOrientation uoOrientation = ScrubberCondenserControl.WATER_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == ScrubberCondenser.WATER_OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ScrubberCondenser.WATER_OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetWaterOutConnectionPoint();
                PointOrientation uoOrientation = ScrubberCondenserControl.WATER_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }


            if (conn != null)
            {
                this.flowsheet.ConnectionManager.AddConnection(conn);
                //this.flowsheet.ConnectionManager.Connections.Add(conn);
                //this.flowsheet.ConnectionManager.DrawConnections();
            }
            return(conn);
        }
Пример #12
0
        private void UpdateStreamsUI()
        {
            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)
            {
                ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(streamIn.Name);
                initializeGrid(processInCtrl, columnIndex, false, "Inlet/Outlets");
                columnIndex += 2;
            }

            if (hasStreamOut)
            {
                Boolean bFirstControl = true;
                if (hasStreamIn)
                {
                    bFirstControl = false;
                }
                IEnumerator e = tee.OutletStreams.GetEnumerator();
                while (e.MoveNext())
                {
                    ProcessStreamBase        processStreamBase = (ProcessStreamBase)e.Current;
                    ProcessStreamBaseControl processOutCtrl    = (ProcessStreamBaseControl)this.TeeCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(processStreamBase.Name);
                    if (bFirstControl)
                    {
                        initializeGrid(processOutCtrl, columnIndex, false, "Inlet/Outlets");
                        columnIndex  += 2;
                        bFirstControl = false;
                    }
                    else
                    {
                        initializeGrid(processOutCtrl, columnIndex, true, "Inlet/Outlets");
                        columnIndex++;
                    }

                    //this.groupBoxStreams.Controls.Add(textBoxStreamOutName);
                    //UI.SetStatusColor(this,statusBar, 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);
                }
            }
        }
Пример #13
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)
            {
                ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasInlet.Name);
                initializeGrid(processInCtrl, columnIndex, false, "Gas Inlet/Outlet");
                columnIndex += 2;
                // 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)
            {
                ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.GasOutlet.Name);
                initializeGrid(processOutCtrl, columnIndex, true, "Gas Inlet/Outlet");
                columnIndex++;
                //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)
            {
                ProcessStreamBaseControl particalOutCtrl = (ProcessStreamBaseControl)this.CycloneCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.CycloneCtrl.Cyclone.ParticleOutlet.Name);
                initializeGrid(particalOutCtrl, columnIndex, false, "Particle Outlet");
                columnIndex += 2;
                //// 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);
            }
        }
Пример #14
0
        public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad)
        {
            //StreamType streamType = StreamType.Unknown;
            //if (ps is DryingGasStream) {
            //   streamType = StreamType.Gas;
            //}
            //else if (ps is ProcessStream) {
            //   streamType = StreamType.Process;
            //}
            //else if (ps is DryingMaterialStream) {
            //   streamType = StreamType.Material;
            //}

            ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps);
            SolvableConnection       conn = null;

            if (ad == TwoStreamUnitOperation.INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = TwoStreamUnitOperation.INLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetStreamInConnectionPoint();
                PointOrientation uoOrientation = TwoStreamUnitOpControl.INLET_ORIENTATION;
                // adjust for Recycle
                if (uo is Recycle)
                {
                    uoOrientation = RecycleControl.INLET_ORIENTATION;
                }
                ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == TwoStreamUnitOperation.OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = TwoStreamUnitOperation.OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetStreamOutConnectionPoint();
                PointOrientation uoOrientation = TwoStreamUnitOpControl.OUTLET_ORIENTATION;
                // adjust for Recycle
                if (uo is Recycle)
                {
                    uoOrientation = RecycleControl.OUTLET_ORIENTATION;
                }
                ConnectionPoint uoConnPoint = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);
                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }

            if (conn != null)
            {
                //this.flowsheet.ConnectionManager.DrawConnection(conn);
                this.flowsheet.ConnectionManager.AddConnection(conn);
                //this.flowsheet.ConnectionManager.Connections.Add(conn);
                //this.flowsheet.ConnectionManager.DrawConnections();
            }
            return(conn);
        }
Пример #15
0
        protected override void ShowConnectionPoints(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestAirIn(p) || HitTestFuelIn(p) || HitTestFlueGasOut(p) || HitTestHeatedIn(p) || HitTestHeatedOut(p))
                {
                    if (HitTestAirIn(p))
                    {
                        idx = FiredHeater.AIR_INLET_INDEX;
                    }
                    else if (HitTestFuelIn(p))
                    {
                        idx = FiredHeater.FUEL_INLET_INDEX;
                    }
                    else if (HitTestHeatedIn(p))
                    {
                        idx = FiredHeater.HEATED_INLET_INDEX;
                    }
                    else if (HitTestHeatedOut(p))
                    {
                        idx = FiredHeater.HEATED_OUTLET_INDEX;
                    }

                    if (this.FiredHeater.CanAttach(idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestAirIn(p))
                    {
                        idx = FiredHeater.AIR_INLET_INDEX;
                    }
                    else if (HitTestFuelIn(p))
                    {
                        idx = FiredHeater.FUEL_INLET_INDEX;
                    }
                    else if (HitTestHeatedIn(p))
                    {
                        idx = FiredHeater.HEATED_INLET_INDEX;
                    }
                    else if (HitTestHeatedOut(p))
                    {
                        idx = FiredHeater.HEATED_OUTLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.FiredHeater.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #16
0
        protected override void UpdateStreamsUI()
        {
            // clear the streams boxes and start again
            this.groupBoxStreams.Controls.Clear();
            BagFilter bagFilter      = this.BagFilterCtrl.BagFilter;
            bool      hasStreamIn    = false;
            bool      hasStreamOut   = false;
            bool      hasParticleOut = false;

            ProcessStreamBase streamIn = bagFilter.GasInlet;

            hasStreamIn = streamIn != null;

            ProcessStreamBase streamOut = bagFilter.GasOutlet;

            hasStreamOut = streamOut != null;

            ProcessStreamBase particleOut = bagFilter.ParticleOutlet;

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

            if (hasStreamIn || hasStreamOut)
            {
                ProcessStreamBase labelsStream = hasStreamIn ? streamIn : streamOut;
                UserControl       ctrl         = null;
                if (labelsStream is DryingGasStream)
                {
                    ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream);
                }

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

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

            if (hasStreamIn && streamIn is DryingGasStream)
            {
                GasStreamControl gasInCtrl = (GasStreamControl)this.BagFilterCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.BagFilterCtrl.BagFilter.GasInlet.Name);
                UserControl      ctrl      = new GasStreamValuesControl(gasInCtrl);

                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 = bagFilter.Inlet.Name;
                UI.SetStatusColor(this.textBoxStreamInName, bagFilter.Inlet.SolveState);
            }

            if (hasStreamOut && streamOut is DryingGasStream)
            {
                ProcessStreamBaseControl baseControl = this.BagFilterCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.BagFilterCtrl.BagFilter.GasOutlet.Name);

                GasStreamControl gasOutCtrl = (GasStreamControl)this.BagFilterCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.BagFilterCtrl.BagFilter.GasOutlet.Name);
                UserControl      ctrl       = new GasStreamValuesControl(gasOutCtrl);

                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 = bagFilter.Outlet.Name;
                UI.SetStatusColor(this.textBoxStreamOutName, bagFilter.Outlet.SolveState);
            }

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

                // add the values
                ProcessStreamBaseControl matOutCtrl = this.BagFilterCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.BagFilterCtrl.BagFilter.ParticleOutlet.Name);
                //ctrl = new ProcessVarValuesControl(matOutCtrl);
                ctrl = new MaterialStreamValuesControl((MaterialStreamControl)matOutCtrl);

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

                this.textBoxParticleOutName.SetSolvable(bagFilter.ParticleOutlet);
                this.groupBoxParticle.Controls.Add(this.textBoxParticleOutName);
                this.textBoxParticleOutName.Text = bagFilter.ParticleOutlet.Name;
                UI.SetStatusColor(this.textBoxParticleOutName, bagFilter.ParticleOutlet.SolveState);
            }
        }
Пример #17
0
        public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad)
        {
            StreamType streamType = StreamType.Unknown;

            if (ps is DryingGasStream)
            {
                streamType = StreamType.Gas;
            }
            else if (ps is ProcessStream)
            {
                streamType = StreamType.Process;
            }
            else if (ps is DryingMaterialStream)
            {
                streamType = StreamType.Material;
            }

            ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps);
            SolvableConnection       conn = null;

            if (ad > 0)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ad;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetStreamInConnectionPoint(ad, uo.InletStreams.Count);
                PointOrientation uoOrientation = MixerControl.INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }
            else if (ad == Mixer.OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = Mixer.OUTLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetStreamOutConnectionPoint();
                PointOrientation uoOrientation = MixerControl.OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }

            if (conn != null)
            {
                this.flowsheet.ConnectionManager.AddConnection(conn);
                //this.flowsheet.ConnectionManager.Connections.Add(conn);
                //this.flowsheet.ConnectionManager.UpdateConnections(this);
                //this.flowsheet.ConnectionManager.DrawConnections();
                this.DoThePaint();
            }
            return(conn);
        }
Пример #18
0
        private void UpdateStreamsUI()
        {
            // clear the stream group-boxes and start again
            //this.groupBoxGasStream.Controls.Clear();
            //this.groupBoxLiquidStream.Controls.Clear();

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

            ProcessStreamBase gasIn = wetScrubber.GasInlet;

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

            ProcessStreamBase gasOut = wetScrubber.GasOutlet;

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

            ProcessStreamBase liquidIn = wetScrubber.LiquidInlet;

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

            ProcessStreamBase liquidOut = wetScrubber.LiquidOutlet;

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

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

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

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

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

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

                //this.textBoxLiquidOutName.Text = wetScrubber.LiquidOutlet.Name;
                //UI.SetStatusColor(this.textBoxLiquidOutName, wetScrubber.LiquidOutlet.SolveState);
            }
        }
Пример #19
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;

            hasGasIn = gasIn != null;

            ProcessStreamBase gasOut = wetScrubber.GasOutlet;

            hasGasOut = gasOut != null;

            ProcessStreamBase liquidIn = wetScrubber.LiquidInlet;

            hasLiquidIn = liquidIn != null;

            ProcessStreamBase liquidOut = wetScrubber.LiquidOutlet;

            hasLiquidOut = liquidOut != null;

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

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

            if (hasGasIn)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.GasInlet.Name);
                UserControl ctrl = null;
                //UserControl ctrl = new ProcessVarValuesControl(baseCtrl);
                if (gasIn is DryingGasStream)
                {
                    GasStreamControl gasInCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasInCtrl);
                }

                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 = this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.GasOutlet.Name);
                UserControl ctrl = null;
                //UserControl ctrl = new ProcessVarValuesControl(baseCtrl);
                if (gasOut is DryingGasStream)
                {
                    GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl;
                    ctrl = new GasStreamValuesControl(gasOutCtrl);
                }
                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 WaterStream) {
                //   ctrl = new ProcessVarLabelsControl(labelsStream.VarList);
                //}
                //else if (labelsStream is DryingGasStream)
                //{
                //   ctrl = new GasStreamLabelsControl((DryingGasStream)labelsStream);
                //}
                if (labelsStream is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamLabelsControl((DryingMaterialStream)labelsStream);
                }
                //UserControl ctrl = new ProcessVarLabelsControl(labelsStream.VarList);

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

            if (hasLiquidIn)
            {
                ProcessStreamBaseControl baseCtrl = this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.LiquidInlet.Name);
                UserControl ctrl = null;
                if (liquidIn is WaterStream)
                {
                    WaterStreamControl processInCtrl = baseCtrl as WaterStreamControl;
                    ctrl = new ProcessVarValuesControl(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);
                }
                //UserControl ctrl = new ProcessVarValuesControl(baseCtrl);

                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 = this.WetScrubberCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.WetScrubberCtrl.WetScrubber.LiquidOutlet.Name);
                UserControl ctrl = null;
                //else if (liquidOut is DryingGasStream) {
                //   GasStreamControl gasOutCtrl = baseCtrl as GasStreamControl;
                //   ctrl = new GasStreamValuesControl(gasOutCtrl);
                //}
                if (liquidOut is DryingMaterialStream)
                {
                    MaterialStreamControl matOutCtrl = baseCtrl as MaterialStreamControl;
                    ctrl = new MaterialStreamValuesControl(matOutCtrl);
                }

                //UserControl ctrl = new ProcessVarValuesControl(baseCtrl);
                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);
            }
        }
Пример #20
0
 protected override UserControl GetNewStreamValuesControl(ProcessStreamBaseControl streamCtrl)
 {
     //return new MaterialStreamValuesControl((MaterialStreamControl)streamCtrl);
     return(new ProcessVarValuesControl(streamCtrl));
 }
Пример #21
0
        protected override void ShowConnectionPoints(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestStreamIn(p) || HitTestStreamOut(p))
                {
                    if (HitTestStreamOut(p))
                    {
                        idx = this.Tee.OutletStreams.Count + 1;
                    }
                    else if (HitTestStreamIn(p))
                    {
                        idx = Tee.INLET_INDEX;
                    }

                    if (this.Tee.CanAttach(idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestStreamOut(p))
                    {
                        idx = this.Tee.OutletStreams.Count + 1;
                    }
                    else if (HitTestStreamIn(p))
                    {
                        idx = Tee.INLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.Tee.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #22
0
 protected virtual UserControl GetNewStreamValuesControl(ProcessStreamBaseControl streamCtrl)
 {
     return(null);
 }
Пример #23
0
        protected override void ShowConnectionPoints(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestGasIn(p) || HitTestGasOut(p) || HitTestLiquidOut(p))
                {
                    if (HitTestGasIn(p))
                    {
                        idx = ScrubberCondenser.GAS_INLET_INDEX;
                    }
                    else if (HitTestGasOut(p))
                    {
                        idx = ScrubberCondenser.GAS_OUTLET_INDEX;
                    }
                    else if (HitTestLiquidOut(p))
                    {
                        idx = ScrubberCondenser.LIQUID_OUTLET_INDEX;
                    }

                    if (this.ScrubberCondenser.CanConnect(idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestGasIn(p))
                    {
                        idx = ScrubberCondenser.GAS_INLET_INDEX;
                    }
                    else if (HitTestGasOut(p))
                    {
                        idx = ScrubberCondenser.GAS_OUTLET_INDEX;
                    }
                    else if (HitTestLiquidOut(p))
                    {
                        idx = ScrubberCondenser.LIQUID_OUTLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.ScrubberCondenser.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #24
0
        //private void Ejector_StreamAttached(UnitOperation uo, ProcessStreamBase ps, int desc) {
        //   this.UpdateStreamsUI();
        //}

        //private void Ejector_StreamDetached(UnitOperation uo, ProcessStreamBase ps) {
        //   this.UpdateStreamsUI();
        //}

        protected override 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;

            hasMotiveIn = motiveIn != null;

            ProcessStreamBase suctionIn = ejector.SuctionInlet;

            hasSuctionIn = suctionIn != null;

            ProcessStreamBase dischargeOut = ejector.DischargeOutlet;

            hasDischargeOut = dischargeOut != null;

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

            if (hasMotiveIn)
            {
                ProcessStreamBaseControl baseCtrl = this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.MotiveInlet.Name);
                UserControl ctrl = null;
                if (motiveIn is WaterStream)
                {
                    ctrl = new ProcessVarValuesControl(baseCtrl);
                }
                else if (motiveIn is DryingGasStream)
                {
                    ctrl = new GasStreamValuesControl((GasStreamControl)baseCtrl);
                }
                else if (motiveIn is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamValuesControl((MaterialStreamControl)baseCtrl);
                }
                //UserControl ctrl = new ProcessVarValuesControl(baseCtrl);

                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)
            {
                ProcessStreamBaseControl baseCtrl = this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.SuctionInlet.Name);
                UserControl ctrl = null;
                if (suctionIn is WaterStream)
                {
                    ctrl = new ProcessVarValuesControl(baseCtrl);
                }
                else if (suctionIn is DryingGasStream)
                {
                    ctrl = new GasStreamValuesControl((GasStreamControl)baseCtrl);
                }
                else if (suctionIn is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamValuesControl((MaterialStreamControl)baseCtrl);
                }
                //UserControl ctrl = new ProcessVarValuesControl(baseCtrl);

                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)
            {
                ProcessStreamBaseControl baseCtrl = this.EjectorCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.EjectorCtrl.Ejector.DischargeOutlet.Name);
                UserControl ctrl = null;
                if (dischargeOut is WaterStream)
                {
                    ctrl = new ProcessVarValuesControl(baseCtrl);
                }
                else if (dischargeOut is DryingMaterialStream)
                {
                    ctrl = new MaterialStreamValuesControl((MaterialStreamControl)baseCtrl);
                }
                else if (dischargeOut is DryingGasStream)
                {
                    ctrl = new GasStreamValuesControl((GasStreamControl)baseCtrl);
                }
                //UserControl ctrl = new ProcessVarValuesControl(baseCtrl);
                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);
            }
        }
Пример #25
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;

            if (coldIn != null)
            {
                hasColdIn = true;
            }

            ProcessStreamBase coldOut = heatExchanger.ColdSideOutlet;

            if (coldOut != null)
            {
                hasColdOut = true;
            }

            ProcessStreamBase hotIn = heatExchanger.HotSideInlet;

            if (hotIn != null)
            {
                hasHotIn = true;
            }

            ProcessStreamBase hotOut = heatExchanger.HotSideOutlet;

            if (hotOut != null)
            {
                hasHotOut = true;
            }

            //if (hasColdIn || hasColdOut)
            //{
            //   ProcessStreamBase labelsStream = null;
            //   if (hasColdIn)
            //      labelsStream = coldIn;
            //   else if (hasColdOut)
            //      labelsStream = coldOut;

            //   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.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);
                initializeGrid(baseCtrl, columnIndex, false, "Inlet/Outlet");
                columnIndex += 2;
                if (hasColdOut)
                {
                    baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideOutlet.Name);
                    initializeGrid(baseCtrl, columnIndex, true, "Inlet/Outlet");
                    columnIndex++;
                }
                //this.textBoxColdInName.Text = heatExchanger.ColdSideInlet.Name;
                //UI.SetStatusColor(this.textBoxColdInName, heatExchanger.ColdSideInlet.SolveState);
            }
            else
            if (hasColdOut)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.ColdSideOutlet.Name);
                initializeGrid(baseCtrl, columnIndex, false, "Inlet/Outlet");
                columnIndex += 2;
                //this.textBoxColdOutName.Text = heatExchanger.ColdSideOutlet.Name;
                //UI.SetStatusColor(this.textBoxColdOutName, heatExchanger.ColdSideOutlet.SolveState);
            }

            if (hasHotIn)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideInlet.Name);
                initializeGrid(baseCtrl, columnIndex, false, "Inlet/Outlet");
                columnIndex += 2;
                if (hasHotOut)
                {
                    baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideOutlet.Name);
                    initializeGrid(baseCtrl, columnIndex, true, "Inlet/Outlet");
                    columnIndex++;
                }
                //this.textBoxHotInName.Text = heatExchanger.HotSideInlet.Name;
                //UI.SetStatusColor(this.textBoxHotInName, heatExchanger.HotSideInlet.SolveState);
            }
            else
            if (hasHotOut)
            {
                ProcessStreamBaseControl baseCtrl = (ProcessStreamBaseControl)this.HeatExchangerCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.HeatExchangerCtrl.HeatExchanger.HotSideOutlet.Name);
                initializeGrid(baseCtrl, columnIndex, false, "Inlet/Outlet");
                columnIndex += 2;
                //this.textBoxHotOutName.Text = heatExchanger.HotSideOutlet.Name;
                //UI.SetStatusColor(this.textBoxHotOutName, heatExchanger.HotSideOutlet.SolveState);
            }
        }
Пример #26
0
        protected override void MouseDownHandler(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestAirIn(p) || HitTestFuelIn(p) || HitTestFlueGasOut(p) || HitTestHeatedIn(p) || HitTestHeatedOut(p))
                {
                    if (HitTestAirIn(p))
                    {
                        idx = FiredHeater.AIR_INLET_INDEX;
                    }
                    else if (HitTestFuelIn(p))
                    {
                        idx = FiredHeater.FUEL_INLET_INDEX;
                    }
                    else if (HitTestFlueGasOut(p))
                    {
                        idx = FiredHeater.FLUE_GAS_OUTLET_INDEX;
                    }
                    else if (HitTestHeatedIn(p))
                    {
                        idx = FiredHeater.HEATED_INLET_INDEX;
                    }
                    else if (HitTestHeatedOut(p))
                    {
                        idx = FiredHeater.HEATED_OUTLET_INDEX;
                    }

                    if (this.FiredHeater.CanAttach(idx))
                    {
                        // ok for the second step
                        this.flowsheet.firstStepCtrl = this;
                        this.flowsheet.SetFlowsheetActivity(FlowsheetActivity.AddingConnStepTwo);
                        this.flowsheet.attachIndex = idx;
                    }
                }
                else
                {
                    this.flowsheet.ResetActivity();
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestAirIn(p))
                    {
                        idx = FiredHeater.AIR_INLET_INDEX;
                    }
                    else if (HitTestFuelIn(p))
                    {
                        idx = FiredHeater.FUEL_INLET_INDEX;
                    }
                    else if (HitTestFlueGasOut(p))
                    {
                        idx = FiredHeater.FLUE_GAS_OUTLET_INDEX;
                    }
                    else if (HitTestHeatedIn(p))
                    {
                        idx = FiredHeater.HEATED_INLET_INDEX;
                    }
                    else if (HitTestHeatedOut(p))
                    {
                        idx = FiredHeater.HEATED_OUTLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.FiredHeater.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        // update the model, the UI will be updated in the listener
                        ErrorMessage error = this.FiredHeater.AttachStream(ctrl.ProcessStreamBase, idx);
                        UI.ShowError(error);
                    }
                }
                this.flowsheet.ResetActivity();
            }
            else
            {
                this.flowsheet.ResetActivity();
                this.PerformSelection();
                this.PrepareForTheMove(p.X, p.Y);
            }
        }
Пример #27
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)
            {
                ProcessStreamBaseControl processInCtrl = (ProcessStreamBaseControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Inlet.Name);
                initializeGrid(processInCtrl, columnIndex, false, "Inlet/Outlet");
                columnIndex += 2;
            }
            if (hasStreamOut)
            {
                ProcessStreamBaseControl processOutCtrl = (ProcessStreamBaseControl)this.TwoStreamUnitOpCtrl.Flowsheet.StreamManager.GetProcessStreamBaseControl(this.TwoStreamUnitOpCtrl.TwoStreamUnitOp.Outlet.Name);
                if (hasStreamIn)
                {
                    initializeGrid(processOutCtrl, columnIndex, true, "Inlet/Outlet");
                    columnIndex++;
                }
                else
                {
                    initializeGrid(processOutCtrl, columnIndex, false, "Inlet/Outlet");
                    columnIndex += 2;
                }
            }
            //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);
            //}
        }
Пример #28
0
        public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad)
        {
            ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps);
            SolvableConnection       conn = null;

            if (ad == FiredHeater.AIR_INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ad;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetAirInConnectionPoint();
                PointOrientation uoOrientation = FiredHeaterControl.AIR_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == FiredHeater.FUEL_INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ad;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetFuelInConnectionPoint();
                PointOrientation uoOrientation = FiredHeaterControl.FUEL_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == FiredHeater.FLUE_GAS_OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ad;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetFlueGasOutConnectionPoint();
                PointOrientation uoOrientation = FiredHeaterControl.FLUE_GAS_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == FiredHeater.HEATED_INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ad;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetHeatedInConnectionPoint();
                PointOrientation uoOrientation = FiredHeaterControl.HEATED_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == FiredHeater.HEATED_OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = ad;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetHeatedOutConnectionPoint();
                PointOrientation uoOrientation = FiredHeaterControl.HEATED_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }

            if (conn != null)
            {
                this.flowsheet.ConnectionManager.AddConnection(conn);
                //this.flowsheet.ConnectionManager.Connections.Add(conn);
                //this.flowsheet.ConnectionManager.DrawConnections();
            }
            return(conn);
        }
Пример #29
0
        public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad)
        {
            //StreamType streamType = StreamType.Unknown;
            //if (ps is DryingGasStream) {
            //   streamType = StreamType.Gas;
            //}
            //else if (ps is ProcessStream) {
            //   streamType = StreamType.Process;
            //}
            //else if (ps is DryingMaterialStream) {
            //   streamType = StreamType.Material;
            //}

            ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps);
            SolvableConnection       conn = null;

            if (ad == Ejector.MOTIVE_INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = Ejector.MOTIVE_INLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetMotiveInConnectionPoint();
                PointOrientation uoOrientation = EjectorControl.MOTIVE_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == Ejector.SUCTION_INLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.OUT_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetOutConnectionPoint();
                PointOrientation strOrientation = ctrl.OutOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = Ejector.SUCTION_INLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetSuctionInConnectionPoint();
                PointOrientation uoOrientation = EjectorControl.SUCTION_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == Ejector.DISCHARGE_OUTLET_INDEX)
            {
                int              strIdx         = ProcessStreamBaseControl.IN_INDEX;
                string           strName        = ctrl.Solvable.Name;
                Point            strPoint       = ctrl.GetInConnectionPoint();
                PointOrientation strOrientation = ctrl.InOrientation;
                ConnectionPoint  strConnPoint   = new ConnectionPoint(strIdx, strName, strPoint, strOrientation);

                int              uoIdx         = Ejector.DISCHARGE_OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetDischargeOutConnectionPoint();
                PointOrientation uoOrientation = EjectorControl.DISCHARGE_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }

            if (conn != null)
            {
                this.flowsheet.ConnectionManager.AddConnection(conn);
                //this.flowsheet.ConnectionManager.Connections.Add(conn);
                //this.flowsheet.ConnectionManager.DrawConnections();
            }
            return(conn);
        }
Пример #30
0
        protected override void ShowConnectionPoints(Point p)
        {
            if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepOne)
            {
                int idx = -1;
                if (HitTestStreamIn(p) || HitTestStreamOut(p) || HitTestParticleOut(p))
                {
                    if (HitTestStreamIn(p))
                    {
                        idx = TwoStreamUnitOperation.INLET_INDEX;
                    }
                    else if (HitTestStreamOut(p))
                    {
                        idx = TwoStreamUnitOperation.OUTLET_INDEX;
                    }
                    else if (HitTestParticleOut(p))
                    {
                        idx = BagFilter.PARTICLE_OUTLET_INDEX;
                    }

                    if (this.UnitOperation.CanAttach(idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else if (this.flowsheet.Activity == FlowsheetActivity.AddingConnStepTwo)
            {
                if (this.flowsheet.firstStepCtrl.Solvable is ProcessStreamBase)
                {
                    int idx = -1;
                    if (HitTestStreamIn(p))
                    {
                        idx = TwoStreamUnitOperation.INLET_INDEX;
                    }
                    else if (HitTestStreamOut(p))
                    {
                        idx = TwoStreamUnitOperation.OUTLET_INDEX;
                    }
                    else if (HitTestParticleOut(p))
                    {
                        idx = BagFilter.PARTICLE_OUTLET_INDEX;
                    }

                    ProcessStreamBaseControl ctrl = (ProcessStreamBaseControl)this.flowsheet.firstStepCtrl;
                    if (this.UnitOperation.CanAttachStream(ctrl.ProcessStreamBase, idx))
                    {
                        this.Cursor = Cursors.Cross;
                    }
                    else
                    {
                        this.Cursor = Cursors.Default;
                    }
                }
                else
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
            }
        }