예제 #1
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;

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

                if (dc.UnitOpPoint.Equals(streamInCp))
                {
                    dc.UnitOpPoint.Point = streamInPoint;
                }
            }
            this.DrawConnections();
        }
예제 #2
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();
        }
예제 #3
0
        //public virtual void SetObjectData(SerializationInfo info, StreamingContext context) {
        public virtual void SetObjectData()
        {
            int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionSolvableConnection", typeof(int));

            this.streamPoint = (ConnectionPoint)Storable.RecallStorableObject(info, context, "StreamPoint", typeof(ConnectionPoint));
            //this.streamPoint.SetObjectData(this.streamPoint.SerializationInfo, this.streamPoint.StreamingContext);
            //this.unitOpPoint.SetObjectData(this.unitOpPoint.SerializationInfo, this.unitOpPoint.StreamingContext);
            this.unitOpPoint = (ConnectionPoint)Storable.RecallStorableObject(info, context, "UnitOpPoint", typeof(ConnectionPoint));
            if (persistedClassVersion == 1)
            {
                StreamType st = (StreamType)info.GetValue("StreamType", typeof(StreamType));
                this.streamType = GetObjectType(st);
            }
            if (persistedClassVersion >= 2)
            {
                this.streamType = (Type)info.GetValue("StreamType", typeof(Type));
                this.flowsheet  = (Flowsheet)info.GetValue("Flowsheet", typeof(Flowsheet));
            }
        }
예제 #4
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;
                }
            }
        }
예제 #5
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;

                if (dc.UnitOpPoint.Equals(inCp))
                {
                    dc.UnitOpPoint.Point = inPoint;
                }
                if (dc.UnitOpPoint.Equals(vaporOutCp))
                {
                    dc.UnitOpPoint.Point = vaporOutPoint;
                }
                if (dc.UnitOpPoint.Equals(liquidOutCp))
                {
                    dc.UnitOpPoint.Point = liquidOutPoint;
                }
            }
            this.DrawConnections();
        }
예제 #6
0
        public void UpdateConnections(ScrubberCondenserControl scrubberCondenserCtrl)
        {
            string name = scrubberCondenserCtrl.ScrubberCondenser.Name;

            PointOrientation gasInOrientation = ScrubberCondenserControl.GAS_INLET_ORIENTATION;
            int             gasInIdx          = ScrubberCondenser.GAS_INLET_INDEX;
            Point           gasInPoint        = scrubberCondenserCtrl.GetGasInConnectionPoint();
            ConnectionPoint gasInCp           = new ConnectionPoint(gasInIdx, name, gasInPoint, gasInOrientation);

            PointOrientation gasOutOrientation = ScrubberCondenserControl.GAS_OUTLET_ORIENTATION;
            int             gasOutIdx          = ScrubberCondenser.GAS_OUTLET_INDEX;
            Point           gasOutPoint        = scrubberCondenserCtrl.GetGasOutConnectionPoint();
            ConnectionPoint gasOutCp           = new ConnectionPoint(gasOutIdx, name, gasOutPoint, gasOutOrientation);

            PointOrientation liquidOutOrientation = ScrubberCondenserControl.LIQUID_OUTLET_ORIENTATION;
            int             liquidOutIdx          = ScrubberCondenser.LIQUID_OUTLET_INDEX;
            Point           liquidOutPoint        = scrubberCondenserCtrl.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(liquidOutCp))
                {
                    dc.UnitOpPoint.Point = liquidOutPoint;
                }
            }
            this.DrawConnections();
        }
예제 #7
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;

                if (dc.UnitOpPoint.Equals(motiveInCp))
                {
                    dc.UnitOpPoint.Point = motiveInPoint;
                }
                if (dc.UnitOpPoint.Equals(suctionInCp))
                {
                    dc.UnitOpPoint.Point = suctionInPoint;
                }
                if (dc.UnitOpPoint.Equals(dischargeOutCp))
                {
                    dc.UnitOpPoint.Point = dischargeOutPoint;
                }
            }
            this.DrawConnections();
        }
예제 #8
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;

                if (dc.UnitOpPoint.Equals(mixtureInCp))
                {
                    dc.UnitOpPoint.Point = mixtureInPoint;
                }
                if (dc.UnitOpPoint.Equals(fluidOutCp))
                {
                    dc.UnitOpPoint.Point = fluidOutPoint;
                }
                if (dc.UnitOpPoint.Equals(particleOutCp))
                {
                    dc.UnitOpPoint.Point = particleOutPoint;
                }
            }
            this.DrawConnections();
        }
예제 #9
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;
                Boolean            isChanged = false;

                if (dc.UnitOpPoint.Equals(coldInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = coldInPoint;
                }
                if (dc.UnitOpPoint.Equals(coldOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = coldOutPoint;
                }
                if (dc.UnitOpPoint.Equals(hotInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = hotInPoint;
                }
                if (dc.UnitOpPoint.Equals(hotOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = hotOutPoint;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
            //this.DrawConnections();
        }
예제 #10
0
        public void UpdateConnections(ScrubberCondenserControl scrubberCondenserCtrl)
        {
            string name = scrubberCondenserCtrl.ScrubberCondenser.Name;

            PointOrientation gasInOrientation = ScrubberCondenserControl.GAS_INLET_ORIENTATION;
            int             gasInIdx          = ScrubberCondenser.GAS_INLET_INDEX;
            Point           gasInPoint        = scrubberCondenserCtrl.GetGasInConnectionPoint();
            ConnectionPoint gasInCp           = new ConnectionPoint(gasInIdx, name, gasInPoint, gasInOrientation);

            PointOrientation gasOutOrientation = ScrubberCondenserControl.GAS_OUTLET_ORIENTATION;
            int             gasOutIdx          = ScrubberCondenser.GAS_OUTLET_INDEX;
            Point           gasOutPoint        = scrubberCondenserCtrl.GetGasOutConnectionPoint();
            ConnectionPoint gasOutCp           = new ConnectionPoint(gasOutIdx, name, gasOutPoint, gasOutOrientation);

            PointOrientation liquidOutOrientation = ScrubberCondenserControl.LIQUID_OUTLET_ORIENTATION;
            int             liquidOutIdx          = ScrubberCondenser.LIQUID_OUTLET_INDEX;
            Point           liquidOutPoint        = scrubberCondenserCtrl.GetLiquidOutConnectionPoint();
            ConnectionPoint liquidOutCp           = new ConnectionPoint(liquidOutIdx, name, liquidOutPoint, liquidOutOrientation);

            PointOrientation waterInOrientation = ScrubberCondenserControl.WATER_INLET_ORIENTATION;
            int             waterInIdx          = ScrubberCondenser.WATER_INLET_INDEX;
            Point           waterInPoint        = scrubberCondenserCtrl.GetWaterInConnectionPoint();
            ConnectionPoint waterInCp           = new ConnectionPoint(waterInIdx, name, waterInPoint, waterInOrientation);

            PointOrientation waterOutOrientation = ScrubberCondenserControl.WATER_OUTLET_ORIENTATION;
            int             waterOutIdx          = ScrubberCondenser.WATER_OUTLET_INDEX;
            Point           waterOutPoint        = scrubberCondenserCtrl.GetWaterOutConnectionPoint();
            ConnectionPoint waterOutCp           = new ConnectionPoint(waterOutIdx, name, waterOutPoint, waterOutOrientation);

            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(liquidOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = liquidOutPoint;
                }
                if (dc.UnitOpPoint.Equals(waterInCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = waterInPoint;
                }
                if (dc.UnitOpPoint.Equals(waterOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = waterOutPoint;
                }

                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
예제 #11
0
 private void Init()
 {
     this.relStreamPoint = new ConnectionPoint();
     this.relUnitOpPoint = new ConnectionPoint();
 }