Ejemplo n.º 1
0
        public void UpdateConnections(ProcessStreamBaseControl streamCtrl)
        {
            string name = streamCtrl.ProcessStreamBase.Name;

            PointOrientation inOrientation = streamCtrl.InOrientation;
            int             inIdx          = ProcessStreamBaseControl.IN_INDEX;
            Point           inPoint        = streamCtrl.GetInConnectionPoint();
            ConnectionPoint inCp           = new ConnectionPoint(inIdx, name, inPoint, inOrientation);

            PointOrientation outOrientation = streamCtrl.OutOrientation;
            int             outIdx          = ProcessStreamBaseControl.OUT_INDEX;
            Point           outPoint        = streamCtrl.GetOutConnectionPoint();
            ConnectionPoint outCp           = new ConnectionPoint(outIdx, name, outPoint, outOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc = (SolvableConnection)e.Current;

                if (dc.StreamPoint.Equals(inCp))
                {
                    dc.StreamPoint.Point       = inPoint;
                    dc.StreamPoint.Orientation = inOrientation;
                }
                if (dc.StreamPoint.Equals(outCp))
                {
                    dc.StreamPoint.Point       = outPoint;
                    dc.StreamPoint.Orientation = outOrientation;
                }
            }
            this.DrawConnections();
        }
Ejemplo n.º 2
0
        public void UpdateConnections(DryerControl dryerCtrl)
        {
            string name = dryerCtrl.Dryer.Name;

            PointOrientation gasInOrientation = DryerControl.GAS_INLET_ORIENTATION;
            int             gasInIdx          = Dryer.GAS_INLET_INDEX;
            Point           gasInPoint        = dryerCtrl.GetGasInConnectionPoint();
            ConnectionPoint gasInCp           = new ConnectionPoint(gasInIdx, name, gasInPoint, gasInOrientation);

            PointOrientation gasOutOrientation = DryerControl.GAS_OUTLET_ORIENTATION;
            int             gasOutIdx          = Dryer.GAS_OUTLET_INDEX;
            Point           gasOutPoint        = dryerCtrl.GetGasOutConnectionPoint();
            ConnectionPoint gasOutCp           = new ConnectionPoint(gasOutIdx, name, gasOutPoint, gasOutOrientation);

            PointOrientation matInOrientation = DryerControl.MATERIAL_INLET_ORIENTATION;
            int             matInIdx          = Dryer.MATERIAL_INLET_INDEX;
            Point           matInPoint        = dryerCtrl.GetMaterialInConnectionPoint();
            ConnectionPoint matInCp           = new ConnectionPoint(matInIdx, name, matInPoint, matInOrientation);

            PointOrientation matOutOrientation = DryerControl.MATERIAL_OUTLET_ORIENTATION;
            int             matOutIdx          = Dryer.MATERIAL_OUTLET_INDEX;
            Point           matOutPoint        = dryerCtrl.GetMaterialOutConnectionPoint();
            ConnectionPoint matOutCp           = new ConnectionPoint(matOutIdx, name, matOutPoint, matOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;

                if (dc.UnitOpPoint.Equals(gasInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = gasInPoint;
                }
                if (dc.UnitOpPoint.Equals(gasOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = gasOutPoint;
                }
                if (dc.UnitOpPoint.Equals(matInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = matInPoint;
                }
                if (dc.UnitOpPoint.Equals(matOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = matOutPoint;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Ejemplo n.º 3
0
        public void UpdateConnections(WetScrubberControl wetScrubberCtrl)
        {
            string name = wetScrubberCtrl.WetScrubber.Name;

            PointOrientation gasInOrientation = WetScrubberControl.GAS_INLET_ORIENTATION;
            int             gasInIdx          = WetScrubber.GAS_INLET_INDEX;
            Point           gasInPoint        = wetScrubberCtrl.GetGasInConnectionPoint();
            ConnectionPoint gasInCp           = new ConnectionPoint(gasInIdx, name, gasInPoint, gasInOrientation);

            PointOrientation gasOutOrientation = WetScrubberControl.GAS_OUTLET_ORIENTATION;
            int             gasOutIdx          = WetScrubber.GAS_OUTLET_INDEX;
            Point           gasOutPoint        = wetScrubberCtrl.GetGasOutConnectionPoint();
            ConnectionPoint gasOutCp           = new ConnectionPoint(gasOutIdx, name, gasOutPoint, gasOutOrientation);

            PointOrientation liquidInOrientation = WetScrubberControl.LIQUID_INLET_ORIENTATION;
            int             liquidInIdx          = WetScrubber.LIQUID_INLET_INDEX;
            Point           liquidInPoint        = wetScrubberCtrl.GetLiquidInConnectionPoint();
            ConnectionPoint liquidInCp           = new ConnectionPoint(liquidInIdx, name, liquidInPoint, liquidInOrientation);

            PointOrientation liquidOutOrientation = WetScrubberControl.LIQUID_OUTLET_ORIENTATION;
            int             liquidOutIdx          = WetScrubber.LIQUID_OUTLET_INDEX;
            Point           liquidOutPoint        = wetScrubberCtrl.GetLiquidOutConnectionPoint();
            ConnectionPoint liquidOutCp           = new ConnectionPoint(liquidOutIdx, name, liquidOutPoint, liquidOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;

                if (dc.UnitOpPoint.Equals(gasInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = gasInPoint;
                }
                if (dc.UnitOpPoint.Equals(gasOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = gasOutPoint;
                }
                if (dc.UnitOpPoint.Equals(liquidInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = liquidInPoint;
                }
                if (dc.UnitOpPoint.Equals(liquidOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = liquidOutPoint;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Ejemplo n.º 4
0
        public void RemoveConnections(string strName, string uoName)
        {
            if (this.Connections.Count > 0)
            {
                ArrayList   toDeleteConnections = new ArrayList();
                IEnumerator e = this.Connections.GetEnumerator();
                while (e.MoveNext())
                {
                    SolvableConnection dc = (SolvableConnection)e.Current;
                    if (dc.StreamPoint.Name.Equals(strName) && dc.UnitOpPoint.Name.Equals(uoName))
                    {
                        toDeleteConnections.Add(dc);
                    }
                }

                if (toDeleteConnections.Count > 0)
                {
                    IEnumerator e2 = toDeleteConnections.GetEnumerator();
                    while (e2.MoveNext())
                    {
                        SolvableConnection conn = (SolvableConnection)e2.Current;
                        this.Connections.Remove(conn);
                    }
                    this.DrawConnections();
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// check if two connection line are the same
        /// </summary>
        /// <param name="conn">connection line control</param>
        /// <returns>true:equal, false: not equal</returns>
        public bool Equals(SolvableConnection conn)
        {
            bool isEqual = false;

            if (this.streamPoint.Equals(conn.streamPoint) && this.unitOpPoint.Equals(conn.unitOpPoint) &&
                this.streamType == conn.StreamType)
            {
                isEqual = true;
            }
            return(isEqual);
        }
Ejemplo n.º 6
0
        public void UpdateConnections(TeeControl teeCtrl)
        {
            string name = teeCtrl.Tee.Name;

            ArrayList streamOutList = new ArrayList();
            int       count         = teeCtrl.Tee.OutletStreams.Count;

            for (int i = 0; i < count; i++)
            {
                PointOrientation streamOutOrientation = TeeControl.OUTLET_ORIENTATION;
                int             streamOutIdx          = i + 1;
                Point           streamOutPoint        = teeCtrl.GetStreamOutConnectionPoint(i + 1, count);
                ConnectionPoint streamOutCp           = new ConnectionPoint(streamOutIdx, name, streamOutPoint, streamOutOrientation);
                streamOutList.Add(streamOutCp);
            }

            PointOrientation streamInOrientation = TeeControl.INLET_ORIENTATION;
            int             streamInIdx          = Tee.INLET_INDEX;
            Point           streamInPoint        = teeCtrl.GetStreamInConnectionPoint();
            ConnectionPoint streamInCp           = new ConnectionPoint(streamInIdx, name, streamInPoint, streamInOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;

                IEnumerator en = streamOutList.GetEnumerator();
                while (en.MoveNext())
                {
                    ConnectionPoint streamOutCp = (ConnectionPoint)en.Current;
                    if (dc.UnitOpPoint.Equals(streamOutCp))
                    {
                        isChanged            = true;
                        dc.UnitOpPoint.Point = streamOutCp.Point;
                    }
                }

                if (dc.UnitOpPoint.Equals(streamInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = streamInPoint;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
            //this.DrawConnections();
        }
Ejemplo n.º 7
0
        public void DeleteConnection(SolvableConnection conn)
        {
            string streamName = conn.StreamPoint.Name;
            string uoName     = conn.UnitOpPoint.Name;

            UnitOpControl            unitOpCtrl = this.flowsheet.UnitOpManager.GetUnitOpControl(uoName);
            ProcessStreamBaseControl psCtrl     = this.flowsheet.StreamManager.GetProcessStreamBaseControl(streamName);

            this.DetachStreamFromUnitOp(unitOpCtrl.UnitOperation, psCtrl.ProcessStreamBase);
            return;
        }
Ejemplo n.º 8
0
        public void UpdateConnections(TwoStreamUnitOpControl twoStrUnitOpCtrl)
        {
            string name = twoStrUnitOpCtrl.TwoStreamUnitOp.Name;

            PointOrientation inOrientation = TwoStreamUnitOpControl.INLET_ORIENTATION;

            // do an adjustment if ti is RecycleControl
            if (twoStrUnitOpCtrl is RecycleControl)
            {
                inOrientation = RecycleControl.INLET_ORIENTATION;
            }
            int             inIdx   = TwoStreamUnitOperation.INLET_INDEX;
            Point           inPoint = twoStrUnitOpCtrl.GetStreamInConnectionPoint();
            ConnectionPoint inCp    = new ConnectionPoint(inIdx, name, inPoint, inOrientation);

            PointOrientation outOrientation = TwoStreamUnitOpControl.OUTLET_ORIENTATION;

            // do an adjustment if ti is RecycleControl
            if (twoStrUnitOpCtrl is RecycleControl)
            {
                outOrientation = RecycleControl.OUTLET_ORIENTATION;
            }
            int             outIdx   = TwoStreamUnitOperation.OUTLET_INDEX;
            Point           outPoint = twoStrUnitOpCtrl.GetStreamOutConnectionPoint();
            ConnectionPoint outCp    = new ConnectionPoint(outIdx, name, outPoint, outOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;
                if (dc.UnitOpPoint.Equals(inCp))
                {
                    //dc.RemoveConnection();
                    dc.UnitOpPoint.Point = inPoint;
                    isChanged            = true;
                }
                if (dc.UnitOpPoint.Equals(outCp))
                {
                    //dc.RemoveConnection();
                    dc.UnitOpPoint.Point = outPoint;
                    isChanged            = true;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Ejemplo n.º 9
0
        public void DrawConnections()
        {
            Graphics g = this.flowsheet.CreateGraphics();

            g.Clear(this.flowsheet.BackColor);
            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection conn = (SolvableConnection)e.Current;
                conn.DrawConnection();
            }
        }
Ejemplo n.º 10
0
        public void UpdateConnections(BagFilterControl bagFilterCtrl)
        {
            string name = bagFilterCtrl.BagFilter.Name;

            PointOrientation inOrientation = BagFilterControl.INLET_ORIENTATION;

            int             inIdx   = BagFilter.INLET_INDEX;
            Point           inPoint = bagFilterCtrl.GetStreamInConnectionPoint();
            ConnectionPoint inCp    = new ConnectionPoint(inIdx, name, inPoint, inOrientation);

            PointOrientation outOrientation = BagFilterControl.OUTLET_ORIENTATION;

            int             outIdx   = BagFilter.OUTLET_INDEX;
            Point           outPoint = bagFilterCtrl.GetStreamOutConnectionPoint();
            ConnectionPoint outCp    = new ConnectionPoint(outIdx, name, outPoint, outOrientation);

            PointOrientation particleOutOrientation = BagFilterControl.PARTICLE_OUTLET_ORIENTATION;
            int             particleOutIdx          = BagFilter.PARTICLE_OUTLET_INDEX;
            Point           particleOutPoint        = bagFilterCtrl.GetParticleOutConnectionPoint();
            ConnectionPoint particleOutCp           = new ConnectionPoint(particleOutIdx, name, particleOutPoint, particleOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;
                if (dc.UnitOpPoint.Equals(inCp))
                {
                    dc.UnitOpPoint.Point = inPoint;
                    isChanged            = true;
                }
                if (dc.UnitOpPoint.Equals(outCp))
                {
                    dc.UnitOpPoint.Point = outPoint;
                    isChanged            = true;
                }
                if (dc.UnitOpPoint.Equals(particleOutCp))
                {
                    dc.UnitOpPoint.Point = particleOutPoint;
                    isChanged            = true;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Ejemplo n.º 11
0
        public void UpdateConnections(FlashTankControl flashTankCtrl)
        {
            string name = flashTankCtrl.FlashTank.Name;

            PointOrientation inOrientation = FlashTankControl.INLET_ORIENTATION;
            int             inIdx          = FlashTank.INLET_INDEX;
            Point           inPoint        = flashTankCtrl.GetInConnectionPoint();
            ConnectionPoint inCp           = new ConnectionPoint(inIdx, name, inPoint, inOrientation);

            PointOrientation vaporOutOrientation = FlashTankControl.VAPOR_OUTLET_ORIENTATION;
            int             vaporOutIdx          = FlashTank.VAPOR_OUTLET_INDEX;
            Point           vaporOutPoint        = flashTankCtrl.GetVaporOutConnectionPoint();
            ConnectionPoint vaporOutCp           = new ConnectionPoint(vaporOutIdx, name, vaporOutPoint, vaporOutOrientation);

            PointOrientation liquidOutOrientation = FlashTankControl.LIQUID_OUTLET_ORIENTATION;
            int             liquidOutIdx          = FlashTank.LIQUID_OUTLET_INDEX;
            Point           liquidOutPoint        = flashTankCtrl.GetLiquidOutConnectionPoint();
            ConnectionPoint liquidOutCp           = new ConnectionPoint(liquidOutIdx, name, liquidOutPoint, liquidOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;

                if (dc.UnitOpPoint.Equals(inCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = inPoint;
                }
                if (dc.UnitOpPoint.Equals(vaporOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = vaporOutPoint;
                }
                if (dc.UnitOpPoint.Equals(liquidOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = liquidOutPoint;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
            //this.DrawConnections();
        }
Ejemplo n.º 12
0
        public void UpdateConnections(CycloneControl cycloneCtrl)
        {
            string name = cycloneCtrl.Cyclone.Name;

            PointOrientation mixtureInOrientation = CycloneControl.MIXTURE_INLET_ORIENTATION;
            int             mixtureInIdx          = Cyclone.GAS_INLET_INDEX;
            Point           mixtureInPoint        = cycloneCtrl.GetGasInConnectionPoint();
            ConnectionPoint mixtureInCp           = new ConnectionPoint(mixtureInIdx, name, mixtureInPoint, mixtureInOrientation);

            PointOrientation fluidOutOrientation = CycloneControl.FLUID_OUTLET_ORIENTATION;
            int             fluidOutIdx          = Cyclone.GAS_OUTLET_INDEX;
            Point           fluidOutPoint        = cycloneCtrl.GetGasOutConnectionPoint();
            ConnectionPoint fluidOutCp           = new ConnectionPoint(fluidOutIdx, name, fluidOutPoint, fluidOutOrientation);

            PointOrientation particleOutOrientation = CycloneControl.PARTICLE_OUTLET_ORIENTATION;
            int             particleOutIdx          = Cyclone.PARTICLE_OUTLET_INDEX;
            Point           particleOutPoint        = cycloneCtrl.GetParticleOutConnectionPoint();
            ConnectionPoint particleOutCp           = new ConnectionPoint(particleOutIdx, name, particleOutPoint, particleOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;

                if (dc.UnitOpPoint.Equals(mixtureInCp))
                {
                    dc.UnitOpPoint.Point = mixtureInPoint;
                    isChanged            = true;
                }
                if (dc.UnitOpPoint.Equals(fluidOutCp))
                {
                    dc.UnitOpPoint.Point = fluidOutPoint;
                    isChanged            = true;
                }
                if (dc.UnitOpPoint.Equals(particleOutCp))
                {
                    dc.UnitOpPoint.Point = particleOutPoint;
                    isChanged            = true;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Ejemplo n.º 13
0
        public void UpdateConnections(BurnerControl burnerCtrl)
        {
            string name = burnerCtrl.Burner.Name;

            PointOrientation airInOrientation = BurnerControl.AIR_INLET_ORIENTATION;
            int             airInIdx          = Burner.AIR_INLET_INDEX;
            Point           airInPoint        = burnerCtrl.GetAirInConnectionPoint();
            ConnectionPoint airInCp           = new ConnectionPoint(airInIdx, name, airInPoint, airInOrientation);

            PointOrientation gasOutOrientation = BurnerControl.FLUE_GAS_OUTLET_ORIENTATION;
            int             gasOutIdx          = Burner.FLUE_GAS_OUTLET_INDEX;
            Point           gasOutPoint        = burnerCtrl.GetFlueGasOutConnectionPoint();
            ConnectionPoint gasOutCp           = new ConnectionPoint(gasOutIdx, name, gasOutPoint, gasOutOrientation);

            PointOrientation fuelInOrientation = BurnerControl.FUEL_INLET_ORIENTATION;
            int             fuelInIdx          = Burner.FUEL_INLET_INDEX;
            Point           fuelInPoint        = burnerCtrl.GetFuelInConnectionPoint();
            ConnectionPoint fuelInCp           = new ConnectionPoint(fuelInIdx, name, fuelInPoint, fuelInOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;

                if (dc.UnitOpPoint.Equals(airInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = airInPoint;
                }
                if (dc.UnitOpPoint.Equals(gasOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = gasOutPoint;
                }
                if (dc.UnitOpPoint.Equals(fuelInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = fuelInPoint;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Ejemplo n.º 14
0
        public void UpdateConnections(WetScrubberControl wetScrubberCtrl)
        {
            string name = wetScrubberCtrl.WetScrubber.Name;

            PointOrientation gasInOrientation = WetScrubberControl.GAS_INLET_ORIENTATION;
            int             gasInIdx          = WetScrubber.GAS_INLET_INDEX;
            Point           gasInPoint        = wetScrubberCtrl.GetGasInConnectionPoint();
            ConnectionPoint gasInCp           = new ConnectionPoint(gasInIdx, name, gasInPoint, gasInOrientation);

            PointOrientation gasOutOrientation = WetScrubberControl.GAS_OUTLET_ORIENTATION;
            int             gasOutIdx          = WetScrubber.GAS_OUTLET_INDEX;
            Point           gasOutPoint        = wetScrubberCtrl.GetGasOutConnectionPoint();
            ConnectionPoint gasOutCp           = new ConnectionPoint(gasOutIdx, name, gasOutPoint, gasOutOrientation);

            PointOrientation liquidInOrientation = WetScrubberControl.LIQUID_INLET_ORIENTATION;
            int             liquidInIdx          = WetScrubber.LIQUID_INLET_INDEX;
            Point           liquidInPoint        = wetScrubberCtrl.GetLiquidInConnectionPoint();
            ConnectionPoint liquidInCp           = new ConnectionPoint(liquidInIdx, name, liquidInPoint, liquidInOrientation);

            PointOrientation liquidOutOrientation = WetScrubberControl.LIQUID_OUTLET_ORIENTATION;
            int             liquidOutIdx          = WetScrubber.LIQUID_OUTLET_INDEX;
            Point           liquidOutPoint        = wetScrubberCtrl.GetLiquidOutConnectionPoint();
            ConnectionPoint liquidOutCp           = new ConnectionPoint(liquidOutIdx, name, liquidOutPoint, liquidOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc = (SolvableConnection)e.Current;

                if (dc.UnitOpPoint.Equals(gasInCp))
                {
                    dc.UnitOpPoint.Point = gasInPoint;
                }
                if (dc.UnitOpPoint.Equals(gasOutCp))
                {
                    dc.UnitOpPoint.Point = gasOutPoint;
                }
                if (dc.UnitOpPoint.Equals(liquidInCp))
                {
                    dc.UnitOpPoint.Point = liquidInPoint;
                }
                if (dc.UnitOpPoint.Equals(liquidOutCp))
                {
                    dc.UnitOpPoint.Point = liquidOutPoint;
                }
            }
            this.DrawConnections();
        }
Ejemplo n.º 15
0
        public void UpdateConnections(HeatExchangerControl heatExchangerCtrl)
        {
            string name = heatExchangerCtrl.HeatExchanger.Name;

            PointOrientation coldInOrientation = HeatExchangerControl.COLD_INLET_ORIENTATION;
            int             coldInIdx          = HeatExchanger.COLD_SIDE_INLET_INDEX;
            Point           coldInPoint        = heatExchangerCtrl.GetColdInConnectionPoint();
            ConnectionPoint coldInCp           = new ConnectionPoint(coldInIdx, name, coldInPoint, coldInOrientation);

            PointOrientation coldOutOrientation = HeatExchangerControl.COLD_OUTLET_ORIENTATION;
            int             coldOutIdx          = HeatExchanger.COLD_SIDE_OUTLET_INDEX;
            Point           coldOutPoint        = heatExchangerCtrl.GetColdOutConnectionPoint();
            ConnectionPoint coldOutCp           = new ConnectionPoint(coldOutIdx, name, coldOutPoint, coldOutOrientation);

            PointOrientation hotInOrientation = HeatExchangerControl.HOT_INLET_ORIENTATION;
            int             hotInIdx          = HeatExchanger.HOT_SIDE_INLET_INDEX;
            Point           hotInPoint        = heatExchangerCtrl.GetHotInConnectionPoint();
            ConnectionPoint hotInCp           = new ConnectionPoint(hotInIdx, name, hotInPoint, hotInOrientation);

            PointOrientation hotOutOrientation = HeatExchangerControl.HOT_OUTLET_ORIENTATION;
            int             hotOutIdx          = HeatExchanger.HOT_SIDE_OUTLET_INDEX;
            Point           hotOutPoint        = heatExchangerCtrl.GetHotOutConnectionPoint();
            ConnectionPoint hotOutCp           = new ConnectionPoint(hotOutIdx, name, hotOutPoint, hotOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc = (SolvableConnection)e.Current;

                if (dc.UnitOpPoint.Equals(coldInCp))
                {
                    dc.UnitOpPoint.Point = coldInPoint;
                }
                if (dc.UnitOpPoint.Equals(coldOutCp))
                {
                    dc.UnitOpPoint.Point = coldOutPoint;
                }
                if (dc.UnitOpPoint.Equals(hotInCp))
                {
                    dc.UnitOpPoint.Point = hotInPoint;
                }
                if (dc.UnitOpPoint.Equals(hotOutCp))
                {
                    dc.UnitOpPoint.Point = hotOutPoint;
                }
            }
            this.DrawConnections();
        }
Ejemplo n.º 16
0
        public void UpdateConnections(DryerControl dryerCtrl)
        {
            string name = dryerCtrl.Dryer.Name;

            PointOrientation gasInOrientation = DryerControl.GAS_INLET_ORIENTATION;
            int             gasInIdx          = Dryer.GAS_INLET_INDEX;
            Point           gasInPoint        = dryerCtrl.GetGasInConnectionPoint();
            ConnectionPoint gasInCp           = new ConnectionPoint(gasInIdx, name, gasInPoint, gasInOrientation);

            PointOrientation gasOutOrientation = DryerControl.GAS_OUTLET_ORIENTATION;
            int             gasOutIdx          = Dryer.GAS_OUTLET_INDEX;
            Point           gasOutPoint        = dryerCtrl.GetGasOutConnectionPoint();
            ConnectionPoint gasOutCp           = new ConnectionPoint(gasOutIdx, name, gasOutPoint, gasOutOrientation);

            PointOrientation matInOrientation = DryerControl.MATERIAL_INLET_ORIENTATION;
            int             matInIdx          = Dryer.MATERIAL_INLET_INDEX;
            Point           matInPoint        = dryerCtrl.GetMaterialInConnectionPoint();
            ConnectionPoint matInCp           = new ConnectionPoint(matInIdx, name, matInPoint, matInOrientation);

            PointOrientation matOutOrientation = DryerControl.MATERIAL_OUTLET_ORIENTATION;
            int             matOutIdx          = Dryer.MATERIAL_OUTLET_INDEX;
            Point           matOutPoint        = dryerCtrl.GetMaterialOutConnectionPoint();
            ConnectionPoint matOutCp           = new ConnectionPoint(matOutIdx, name, matOutPoint, matOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc = (SolvableConnection)e.Current;

                if (dc.UnitOpPoint.Equals(gasInCp))
                {
                    dc.UnitOpPoint.Point = gasInPoint;
                }
                if (dc.UnitOpPoint.Equals(gasOutCp))
                {
                    dc.UnitOpPoint.Point = gasOutPoint;
                }
                if (dc.UnitOpPoint.Equals(matInCp))
                {
                    dc.UnitOpPoint.Point = matInPoint;
                }
                if (dc.UnitOpPoint.Equals(matOutCp))
                {
                    dc.UnitOpPoint.Point = matOutPoint;
                }
            }
            this.DrawConnections();
        }
Ejemplo n.º 17
0
        public void RemoveConnections(string name, int whom)
        {
            if (this.Connections.Count > 0)
            {
                ArrayList   toDeleteConnections = new ArrayList();
                IEnumerator e = this.Connections.GetEnumerator();
                while (e.MoveNext())
                {
                    SolvableConnection dc = (SolvableConnection)e.Current;
                    switch (whom)
                    {
                    case STREAM:
                        if (dc.StreamPoint.Name.Equals(name))
                        {
                            toDeleteConnections.Add(dc);
                        }
                        break;

                    case UNIT_OP:
                        if (dc.UnitOpPoint.Name.Equals(name))
                        {
                            toDeleteConnections.Add(dc);
                        }
                        break;

                    case ALL:
                        if (dc.StreamPoint.Name.Equals(name) || dc.UnitOpPoint.Name.Equals(name))
                        {
                            toDeleteConnections.Add(dc);
                        }
                        break;

                    default:
                        break;
                    }
                }

                if (toDeleteConnections.Count > 0)
                {
                    IEnumerator e2 = toDeleteConnections.GetEnumerator();
                    while (e2.MoveNext())
                    {
                        SolvableConnection conn = (SolvableConnection)e2.Current;
                        this.Connections.Remove(conn);
                    }
                    this.DrawConnections();
                }
            }
        }
Ejemplo n.º 18
0
        //private static Flowsheet UnpersistFlowsheet1_01(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, ArrayList persistedItems, string flowsheetName) {
        private static Flowsheet UnpersistFlowsheet1_01(ArrayList persistedItems, string flowsheetName, ApplicationPreferences appPrefs)
        {
            Flowsheet flowsheet = null;

            foreach (object obj in persistedItems)
            {
                if (obj is EvaporationAndDryingSystem)
                {
                    EvaporationAndDryingSystem persisted = (EvaporationAndDryingSystem)obj;
                    persisted.SetSystemFileName(flowsheetName); // call this before SetObjectData()
                    persisted.SetObjectData();
                    //flowsheet = new Flowsheet(newProcessSettings, appPrefs, persisted);
                    flowsheet = new Flowsheet(persisted, appPrefs);
                }
                else if (obj is SolvableControl)
                {
                    SolvableControl persistedCtrl = (SolvableControl)obj;

                    persistedCtrl.Flowsheet = flowsheet;
                    persistedCtrl.SetObjectData();

                    //string solvableName = (string)persistedCtrl.NameControl.Text;
                    //Solvable solvable = flowsheet.EvaporationAndDryingSystem.GetSolvable(solvableName);
                    //persistedCtrl.Solvable = solvable;
                    flowsheet.Controls.Add(persistedCtrl);
                }
                else if (obj is SolvableConnection)
                {
                    SolvableConnection persistedDc = (SolvableConnection)obj;
                    persistedDc.Flowsheet = flowsheet;
                    persistedDc.SetObjectData();
                    persistedDc.UpdateConnection();
                    flowsheet.ConnectionManager.AddConnection(persistedDc);
                }
                else if (obj is FlowsheetPreferences)
                {
                    FlowsheetPreferences flowsheetPrefs = obj as FlowsheetPreferences;
                    flowsheetPrefs.SetObjectData();
                    flowsheet.BackColor = flowsheetPrefs.BackColor;
                }
                else if (obj is ProsimoUI.CustomEditor.CustomEditor)
                {
                    ProsimoUI.CustomEditor.CustomEditor persistedEditor = (ProsimoUI.CustomEditor.CustomEditor)obj;
                    persistedEditor.Flowsheet = flowsheet;
                    persistedEditor.SetObjectData();
                }
            }
            return(flowsheet);
        }
Ejemplo n.º 19
0
        public void UpdateConnections(EjectorControl ejectorCtrl)
        {
            string name = ejectorCtrl.Ejector.Name;

            PointOrientation motiveInOrientation = EjectorControl.MOTIVE_INLET_ORIENTATION;
            int             motiveInIdx          = Ejector.MOTIVE_INLET_INDEX;
            Point           motiveInPoint        = ejectorCtrl.GetMotiveInConnectionPoint();
            ConnectionPoint motiveInCp           = new ConnectionPoint(motiveInIdx, name, motiveInPoint, motiveInOrientation);

            PointOrientation suctionInOrientation = EjectorControl.SUCTION_INLET_ORIENTATION;
            int             suctionInIdx          = Ejector.SUCTION_INLET_INDEX;
            Point           suctionInPoint        = ejectorCtrl.GetSuctionInConnectionPoint();
            ConnectionPoint suctionInCp           = new ConnectionPoint(suctionInIdx, name, suctionInPoint, suctionInOrientation);

            PointOrientation dischargeOutOrientation = EjectorControl.DISCHARGE_OUTLET_ORIENTATION;
            int             dischargeOutIdx          = Ejector.DISCHARGE_OUTLET_INDEX;
            Point           dischargeOutPoint        = ejectorCtrl.GetDischargeOutConnectionPoint();
            ConnectionPoint dischargeOutCp           = new ConnectionPoint(dischargeOutIdx, name, dischargeOutPoint, dischargeOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;
                if (dc.UnitOpPoint.Equals(motiveInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = motiveInPoint;
                }
                if (dc.UnitOpPoint.Equals(suctionInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = suctionInPoint;
                }
                if (dc.UnitOpPoint.Equals(dischargeOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = dischargeOutPoint;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Ejemplo n.º 20
0
 private void ChangeCursorOverConnection(Point p)
 {
     this.Cursor = Cursors.No;
     if (this.connectionManager.Connections.Count > 0)
     {
         IEnumerator e = this.connectionManager.Connections.GetEnumerator();
         while (e.MoveNext())
         {
             SolvableConnection conn = (SolvableConnection)e.Current;
             if (conn.HitTest(p))
             {
                 this.Cursor = Cursors.Cross;
                 break;
             }
         }
     }
 }
Ejemplo n.º 21
0
 public void RemoveConnections(string strName, string uoName)
 {
     if (this.Connections.Count > 0)
     {
         ArrayList   toDeleteConnections = new ArrayList();
         IEnumerator e = this.Connections.GetEnumerator();
         while (e.MoveNext())
         {
             SolvableConnection dc = (SolvableConnection)e.Current;
             if (dc.StreamPoint.Name.Equals(strName) && dc.UnitOpPoint.Name.Equals(uoName))
             {
                 this.flowsheet.Controls.Remove(dc);
                 this.Connections.Remove(dc);
             }
         }
     }
 }
Ejemplo n.º 22
0
        public void UpdateConnections(MixerControl mixerCtrl)
        {
            string name = mixerCtrl.Mixer.Name;

            ArrayList streamInList = new ArrayList();
            int       count        = mixerCtrl.Mixer.InletStreams.Count;

            for (int i = 0; i < count; i++)
            {
                PointOrientation streamInOrientation = MixerControl.INLET_ORIENTATION;
                int             streamInIdx          = i + 1;
                Point           streamInPoint        = mixerCtrl.GetStreamInConnectionPoint(i + 1, count);
                ConnectionPoint streamInCp           = new ConnectionPoint(streamInIdx, name, streamInPoint, streamInOrientation);
                streamInList.Add(streamInCp);
            }

            PointOrientation streamOutOrientation = MixerControl.OUTLET_ORIENTATION;
            int             streamOutIdx          = Mixer.OUTLET_INDEX;
            Point           streamOutPoint        = mixerCtrl.GetStreamOutConnectionPoint();
            ConnectionPoint streamOutCp           = new ConnectionPoint(streamOutIdx, name, streamOutPoint, streamOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc = (SolvableConnection)e.Current;

                IEnumerator en = streamInList.GetEnumerator();
                while (en.MoveNext())
                {
                    ConnectionPoint streamInCp = (ConnectionPoint)en.Current;
                    if (dc.UnitOpPoint.Equals(streamInCp))
                    {
                        dc.UnitOpPoint.Point = streamInCp.Point;
                    }
                }

                if (dc.UnitOpPoint.Equals(streamOutCp))
                {
                    dc.UnitOpPoint.Point = streamOutPoint;
                }
            }
            this.DrawConnections();
        }
Ejemplo n.º 23
0
        public void UpdateConnections(TwoStreamUnitOpControl twoStrUnitOpCtrl)
        {
            string name = twoStrUnitOpCtrl.TwoStreamUnitOp.Name;

            PointOrientation inOrientation = TwoStreamUnitOpControl.INLET_ORIENTATION;

            // do an adjustment if ti is RecycleControl
            if (twoStrUnitOpCtrl is RecycleControl)
            {
                inOrientation = RecycleControl.INLET_ORIENTATION;
            }
            int             inIdx   = TwoStreamUnitOperation.INLET_INDEX;
            Point           inPoint = twoStrUnitOpCtrl.GetStreamInConnectionPoint();
            ConnectionPoint inCp    = new ConnectionPoint(inIdx, name, inPoint, inOrientation);

            PointOrientation outOrientation = TwoStreamUnitOpControl.OUTLET_ORIENTATION;

            // do an adjustment if ti is RecycleControl
            if (twoStrUnitOpCtrl is RecycleControl)
            {
                outOrientation = RecycleControl.OUTLET_ORIENTATION;
            }
            int             outIdx   = TwoStreamUnitOperation.OUTLET_INDEX;
            Point           outPoint = twoStrUnitOpCtrl.GetStreamOutConnectionPoint();
            ConnectionPoint outCp    = new ConnectionPoint(outIdx, name, outPoint, outOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc = (SolvableConnection)e.Current;

                if (dc.UnitOpPoint.Equals(inCp))
                {
                    dc.UnitOpPoint.Point = inPoint;
                }
                if (dc.UnitOpPoint.Equals(outCp))
                {
                    dc.UnitOpPoint.Point = outPoint;
                }
            }
            this.DrawConnections();
        }
Ejemplo n.º 24
0
        public void UpdateConnections(ProcessStreamBaseControl streamCtrl)
        {
            string name = streamCtrl.ProcessStreamBase.Name;

            PointOrientation inOrientation = streamCtrl.InOrientation;
            int             inIdx          = ProcessStreamBaseControl.IN_INDEX;
            Point           inPoint        = streamCtrl.GetInConnectionPoint();
            ConnectionPoint inCp           = new ConnectionPoint(inIdx, name, inPoint, inOrientation);

            PointOrientation outOrientation = streamCtrl.OutOrientation;
            int             outIdx          = ProcessStreamBaseControl.OUT_INDEX;
            Point           outPoint        = streamCtrl.GetOutConnectionPoint();
            ConnectionPoint outCp           = new ConnectionPoint(outIdx, name, outPoint, outOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;

                if (dc.StreamPoint.Equals(inCp))
                {
                    dc.StreamPoint.Orientation = inOrientation;
                    dc.StreamPoint.Point       = inPoint;
                    isChanged = true;
                }
                if (dc.StreamPoint.Equals(outCp))
                {
                    dc.StreamPoint.Orientation = outOrientation;
                    dc.StreamPoint.Point       = outPoint;
                    isChanged = true;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Ejemplo n.º 25
0
        public void SetOwner(string oldName, string newName)
        {
            if (this.Connections.Count > 0)
            {
                IEnumerator e = this.Connections.GetEnumerator();
                while (e.MoveNext())
                {
                    SolvableConnection dc = (SolvableConnection)e.Current;

                    if (dc.StreamPoint.Name.Equals(oldName))
                    {
                        dc.StreamPoint.Name = newName;
                    }
                    if (dc.UnitOpPoint.Name.Equals(oldName))
                    {
                        dc.UnitOpPoint.Name = newName;
                    }
                }
            }
        }
Ejemplo n.º 26
0
        public void DeleteConnection(Point p)
        {
            if (this.Connections.Count > 0)
            {
                IEnumerator e4 = this.Connections.GetEnumerator();
                while (e4.MoveNext())
                {
                    SolvableConnection conn = (SolvableConnection)e4.Current;
                    if (conn.HitTest(p))
                    {
                        string streamName = conn.StreamPoint.Name;
                        string uoName     = conn.UnitOpPoint.Name;

                        UnitOpControl            unitOpCtrl = this.flowsheet.UnitOpManager.GetUnitOpControl(uoName);
                        ProcessStreamBaseControl psCtrl     = this.flowsheet.StreamManager.GetProcessStreamBaseControl(streamName);
                        this.DetachStreamFromUnitOp(unitOpCtrl.UnitOperation, psCtrl.ProcessStreamBase);

                        break;
                    }
                }
            }
        }
Ejemplo n.º 27
0
        private Flowsheet SetFlowsheetContent(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, ArrayList items, string flowsheetName)
        {
            Flowsheet   flowsheet = null;
            IEnumerator e         = items.GetEnumerator();

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

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

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

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

            return(flowsheet);
        }
Ejemplo n.º 28
0
 public void DrawConnection(SolvableConnection conn)
 {
     this.flowsheet.Controls.Add(conn);
 }
Ejemplo n.º 29
0
        private ArrayList GetFlowsheetContent(Flowsheet flowsheet)
        {
            ArrayList toSerializeItems = new ArrayList();

            toSerializeItems.Add(flowsheet.EvaporationAndDryingSystem);

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

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

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

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

            toSerializeItems.Add(flowsheetPrefs);

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

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

            return(toSerializeItems);
        }