Exemplo n.º 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;
                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();
        }
Exemplo n.º 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;
                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;
                }
            }
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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;
                }
            }
        }
Exemplo n.º 5
0
        public virtual void SetObjectData(SerializationInfo info, StreamingContext context)
        {
            int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionConnectionPoint", typeof(int));

            switch (persistedClassVersion)
            {
            case 1:
                this.Index       = (int)info.GetValue("Index", typeof(int));
                this.Name        = (string)info.GetValue("Name", typeof(string));
                this.Point       = (Point)info.GetValue("Point", typeof(Point));
                this.Orientation = (PointOrientation)info.GetValue("Orientation", typeof(PointOrientation));
                break;
            }
        }
Exemplo n.º 6
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;
                }
            }
        }
Exemplo n.º 7
0
        //public virtual void SetObjectData(SerializationInfo info, StreamingContext context)
        public override void SetObjectData()
        {
            int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionConnectionPoint", typeof(int));

            switch (persistedClassVersion)
            {
            case 1:
                this.Index       = (int)info.GetValue("Index", typeof(int));
                this.Name        = (string)info.GetValue("Name", typeof(string));
                this.Point       = (Point)info.GetValue("Point", typeof(Point));
                this.Orientation = (PointOrientation)info.GetValue("Orientation", typeof(PointOrientation));
                break;
            }
        }
Exemplo n.º 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;
                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;
                }
            }
        }
Exemplo n.º 9
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;
                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 (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
        }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
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();
        }
Exemplo n.º 12
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();
        }
Exemplo n.º 13
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;
                }
            }
        }
Exemplo n.º 14
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();
        }
Exemplo n.º 15
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();
        }
Exemplo n.º 16
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;
                }
            }
        }
Exemplo n.º 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 == Cyclone.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         = Cyclone.GAS_INLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetGasInConnectionPoint();
                PointOrientation uoOrientation = CycloneControl.MIXTURE_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == Cyclone.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         = Cyclone.GAS_OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetGasOutConnectionPoint();
                PointOrientation uoOrientation = CycloneControl.FLUID_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == Cyclone.PARTICLE_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         = Cyclone.PARTICLE_OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetParticleOutConnectionPoint();
                PointOrientation uoOrientation = CycloneControl.PARTICLE_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);
        }
Exemplo n.º 18
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 == FlashTank.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         = FlashTank.INLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetInConnectionPoint();
                PointOrientation uoOrientation = FlashTankControl.INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }
            else if (ad == FlashTank.VAPOR_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         = FlashTank.VAPOR_OUTLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetVaporOutConnectionPoint();
                PointOrientation uoOrientation = FlashTankControl.VAPOR_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }
            else if (ad == FlashTank.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         = FlashTank.LIQUID_OUTLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetLiquidOutConnectionPoint();
                PointOrientation uoOrientation = FlashTankControl.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.AddConnection(conn);
                //this.flowsheet.ConnectionManager.Connections.Add(conn);
                //this.flowsheet.ConnectionManager.DrawConnections();
            }
            return(conn);
        }
Exemplo n.º 19
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, streamType);
            }
            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, streamType);
            }
            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, streamType);
            }

            if (conn != null)
            {
                this.flowsheet.ConnectionManager.AddConnection(conn);
                //this.flowsheet.ConnectionManager.Connections.Add(conn);
                //this.flowsheet.ConnectionManager.DrawConnections();
            }
            return(conn);
        }
Exemplo n.º 20
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 == Dryer.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         = Dryer.GAS_INLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetGasInConnectionPoint();
                PointOrientation uoOrientation = DryerControl.GAS_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }
            else if (ad == Dryer.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         = Dryer.GAS_OUTLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetGasOutConnectionPoint();
                PointOrientation uoOrientation = DryerControl.GAS_OUTLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }
            else if (ad == Dryer.MATERIAL_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         = Dryer.MATERIAL_INLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetMaterialInConnectionPoint();
                PointOrientation uoOrientation = DryerControl.MATERIAL_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, streamType);
            }
            else if (ad == Dryer.MATERIAL_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         = Dryer.MATERIAL_OUTLET_INDEX;
                string           uoName        = this.Solvable.Name;
                Point            uoPoint       = this.GetMaterialOutConnectionPoint();
                PointOrientation uoOrientation = DryerControl.MATERIAL_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();
            }
        }
        /// <summary>
        /// Based on a line described by <paramref name="start" /> and <paramref name="end" />
        /// populates a buffer for all points on the path that the line intersects.
        /// </summary>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        /// <param name="buffer">The buffer.</param>
        /// <param name="orientationsSpan">The buffer for storeing the orientation of each intersection.</param>
        /// <returns>number of intersections hit</returns>
        public int FindIntersectionsWithOrientation(PointF start, PointF end, Span <PointF> buffer, Span <PointOrientation> orientationsSpan)
        {
            if (this.points.Length < 2)
            {
                return(0);
            }

            int count = buffer.Length;

            this.ClampPoints(ref start, ref end);

            var target = new Segment(start, end);

            int polyCorners = this.points.Length;

            if (!this.closedPath)
            {
                polyCorners -= 1;
            }

            int     position  = 0;
            Vector2 lastPoint = MaxVector;

            PassPointData[] precaclulate = ArrayPool <PassPointData> .Shared.Rent(this.points.Length);

            Span <PassPointData> precaclulateSpan = precaclulate.AsSpan(0, this.points.Length);

            try
            {
                // pre calculate relative orientations X places ahead and behind
                Vector2          startToEnd           = end - start;
                PointOrientation prevOrientation      = CalulateOrientation(startToEnd, this.points[polyCorners - 1].Point - end);
                PointOrientation nextOrientation      = CalulateOrientation(startToEnd, this.points[0].Point - end);
                PointOrientation nextPlus1Orientation = CalulateOrientation(startToEnd, this.points[1].Point - end);

                // iterate over all points and precalculate data about each, pre cacluating it relative orientation
                for (int i = 0; i < polyCorners && count > 0; i++)
                {
                    ref Segment edge = ref this.points[i].Segment;

                    // shift all orientations along but one place and fill in the last one
                    PointOrientation pointOrientation = nextOrientation;
                    nextOrientation      = nextPlus1Orientation;
                    nextPlus1Orientation = CalulateOrientation(startToEnd, this.points[WrapArrayIndex(i + 2, this.points.Length)].Point - end);

                    // should this point cause the last matched point to be excluded
                    bool removeLastIntersection = nextOrientation == PointOrientation.Colinear &&
                                                  pointOrientation == PointOrientation.Colinear &&
                                                  nextPlus1Orientation != prevOrientation &&
                                                  (this.closedPath || i > 0) &&
                                                  (IsOnSegment(target, edge.Start) || IsOnSegment(target, edge.End));

                    // is there any chance the segments will intersection (do their bounding boxes touch)
                    bool doIntersect = false;
                    if (pointOrientation == PointOrientation.Colinear || pointOrientation != nextOrientation)
                    {
                        doIntersect = (edge.Min.X - Epsilon) <= target.Max.X &&
                                      (edge.Max.X + Epsilon) >= target.Min.X &&
                                      (edge.Min.Y - Epsilon) <= target.Max.Y &&
                                      (edge.Max.Y + Epsilon) >= target.Min.Y;
                    }

                    precaclulateSpan[i] = new PassPointData
                    {
                        RemoveLastIntersectionAndSkip = removeLastIntersection,
                        RelativeOrientation           = pointOrientation,
                        DoIntersect = doIntersect
                    };

                    prevOrientation = pointOrientation;
                }

                // seed the last point for deduping at begining of closed line
                if (this.closedPath)
                {
                    int prev = polyCorners - 1;

                    if (precaclulateSpan[prev].DoIntersect)
                    {
                        lastPoint = FindIntersection(this.points[prev].Segment, target);
                    }
                }

                for (int i = 0; i < polyCorners && count > 0; i++)
                {
                    int next = WrapArrayIndex(i + 1, this.points.Length);

                    if (precaclulateSpan[i].RemoveLastIntersectionAndSkip)
                    {
                        if (position > 0)
                        {
                            position--;
                            count++;
                        }

                        continue;
                    }

                    if (precaclulateSpan[i].DoIntersect)
                    {
                        Vector2 point = FindIntersection(this.points[i].Segment, target);
                        if (point != MaxVector)
                        {
                            if (lastPoint.Equivalent(point, Epsilon2))
                            {
                                lastPoint = MaxVector;

                                int last = WrapArrayIndex(i - 1 + polyCorners, polyCorners);

                                // hit the same point a second time do we need to remove the old one if just clipping
                                if (this.points[next].Point.Equivalent(point, Epsilon))
                                {
                                    next = i;
                                }

                                if (this.points[last].Point.Equivalent(point, Epsilon))
                                {
                                    last = i;
                                }

                                PointOrientation side  = precaclulateSpan[next].RelativeOrientation;
                                PointOrientation side2 = precaclulateSpan[last].RelativeOrientation;

                                if (side != side2)
                                {
                                    // differnet side we skip adding as we are passing through it
                                    continue;
                                }
                            }

                            // only need to track this during odd non zero rulings
                            orientationsSpan[position] = precaclulateSpan[i].RelativeOrientation;
                            buffer[position]           = point;
                            position++;
                            count--;
                        }

                        lastPoint = point;
                    }
                    else
                    {
                        lastPoint = MaxVector;
                    }
                }

                Vector2      startVector = start;
                Span <float> distances   = stackalloc float[position];
                for (int i = 0; i < position; i++)
                {
                    distances[i] = Vector2.DistanceSquared(startVector, buffer[i]);
                }

                var activeBuffer           = buffer.Slice(0, position);
                var activeOrientationsSpan = orientationsSpan.Slice(0, position);
                SortUtility.Sort(distances, activeBuffer, activeOrientationsSpan);

                return(position);
            }
Exemplo n.º 22
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, streamType);
            }
            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, streamType);
            }

            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);
        }
Exemplo n.º 23
0
        private static PointData[] Simplify(ReadOnlyMemory <PointF> vectors, bool isClosed, bool removeCloseAndCollinear)
        {
            ReadOnlySpan <PointF> points = vectors.Span;

            int polyCorners = points.Length;

            if (polyCorners == 0)
            {
                return(Array.Empty <PointData>());
            }

            var     results   = new List <PointData>();
            Vector2 lastPoint = points[0];

            if (!isClosed)
            {
                results.Add(new PointData
                {
                    Point       = points[0],
                    Orientation = PointOrientation.Collinear,
                    Length      = 0
                });
            }
            else
            {
                int prev = polyCorners;
                do
                {
                    prev--;
                    if (prev == 0)
                    {
                        // All points are common, shouldn't match anything
                        results.Add(
                            new PointData
                        {
                            Point       = points[0],
                            Orientation = PointOrientation.Collinear,
                            Length      = 0,
                        });

                        return(results.ToArray());
                    }
                }while (removeCloseAndCollinear && points[0].Equivalent(points[prev], Epsilon2)); // skip points too close together

                polyCorners = prev + 1;
                lastPoint   = points[prev];

                results.Add(
                    new PointData
                {
                    Point       = points[0],
                    Orientation = CalulateOrientation(lastPoint, points[0], points[1]),
                    Length      = Vector2.Distance(lastPoint, points[0]),
                });

                lastPoint = points[0];
            }

            float totalDist = 0;

            for (int i = 1; i < polyCorners; i++)
            {
                int next            = WrapArrayIndex(i + 1, polyCorners);
                PointOrientation or = CalulateOrientation(lastPoint, points[i], points[next]);
                if (or == PointOrientation.Collinear && next != 0)
                {
                    continue;
                }

                float dist = Vector2.Distance(lastPoint, points[i]);
                totalDist += dist;
                results.Add(
                    new PointData
                {
                    Point       = points[i],
                    Orientation = or,
                    Length      = dist,
                });
                lastPoint = points[i];
            }

            if (isClosed && removeCloseAndCollinear)
            {
                // walk back removing collinear points
                while (results.Count > 2 && results.Last().Orientation == PointOrientation.Collinear)
                {
                    results.RemoveAt(results.Count - 1);
                }
            }

            return(results.ToArray());
        }
Exemplo n.º 24
0
        public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad)
        {
            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());
            }
            else if (ad == Cyclone.PARTICLE_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         = Cyclone.PARTICLE_OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetParticleOutConnectionPoint();
                PointOrientation uoOrientation = PARTICLE_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);
            }
            return(conn);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Intersect the box with existent edges and cut any portion of the edge, or whole edge,
        /// that is inside the box. Note that no new connections are created afterwards.
        /// </summary>
        /// <param name="box">Boding box to subtract</param>
        /// <param name="removeCutEdges">Should edge be removed or replaced by leftover pieces</param>
        public void SubtractBox(BBox3 box, bool removeCutEdges = false)
        {
            List <Edge> edgesToDelete = new List <Edge>();

            foreach (var edge in GetEdges())
            {
                var start = GetVertex(edge.StartId);
                var end   = GetVertex(edge.EndId);
                PointOrientation startZ = Orientation(start.Point.Z, box.Min.Z, box.Max.Z);
                PointOrientation endZ   = Orientation(end.Point.Z, box.Min.Z, box.Max.Z);
                if (startZ == endZ && startZ != PointOrientation.Inside)
                {
                    continue;
                }

                //Z coordinates and X/Y are treated differently.
                //If edge lies on one of X or Y planes of the box - it's not treated as "Inside" and edge is kept.
                //If edge lies on one of Z planes - it's still "Inside", so edge is cut or removed.
                //This is because we don't want travel under or over obstacles on elevation where they start/end.
                PointOrientation startX = OrientationTolerance(start.Point.X, box.Min.X, box.Max.X);
                PointOrientation startY = OrientationTolerance(start.Point.Y, box.Min.Y, box.Max.Y);
                PointOrientation endX   = OrientationTolerance(end.Point.X, box.Min.X, box.Max.X);
                PointOrientation endY   = OrientationTolerance(end.Point.Y, box.Min.Y, box.Max.Y);

                if ((startX == endX && startX != PointOrientation.Inside) ||
                    (startY == endY && startY != PointOrientation.Inside))
                {
                    continue;
                }

                bool startInside = startZ == PointOrientation.Inside &&
                                   startX == PointOrientation.Inside &&
                                   startY == PointOrientation.Inside;

                bool endInside = endZ == PointOrientation.Inside &&
                                 endX == PointOrientation.Inside &&
                                 endY == PointOrientation.Inside;


                if (startInside && endInside)
                {
                    edgesToDelete.Add(edge);
                }
                else
                {
                    var            edgeLine = edge.GetGeometry();
                    List <Vector3> intersections;
                    edgeLine.Intersects(box, out intersections);
                    // If no intersection found than outside point is exactly within tolerance.
                    // But since Intersects works on 0 to 1 range internally, mismatch in interpretation
                    // is possible. Cut the edge in this case.
                    if (intersections.Count == 0)
                    {
                        edgesToDelete.Add(edge);
                    }
                    // Intersections are sorted from the start point.
                    else if (intersections.Count == 1)
                    {
                        //Need to find which end is inside the box.
                        //If none - we just touched the corner
                        if (startInside)
                        {
                            if (!removeCutEdges)
                            {
                                var v = AddVertex(intersections[0]);
                                if (edge.EndId != v.Id)
                                {
                                    AddEdge(v.Id, edge.EndId);
                                }
                            }
                            edgesToDelete.Add(edge);
                        }
                        else if (endInside)
                        {
                            if (!removeCutEdges)
                            {
                                var v = AddVertex(intersections[0]);
                                if (edge.StartId != v.Id)
                                {
                                    AddEdge(edge.StartId, v.Id);
                                }
                            }
                            edgesToDelete.Add(edge);
                        }
                    }
                    if (intersections.Count == 2)
                    {
                        if (!removeCutEdges)
                        {
                            var v0 = AddVertex(intersections[0]);
                            var v1 = AddVertex(intersections[1]);
                            if (edge.StartId != v0.Id)
                            {
                                AddEdge(edge.StartId, v0.Id);
                            }
                            if (edge.EndId != v1.Id)
                            {
                                AddEdge(v1.Id, edge.EndId);
                            }
                        }
                        edgesToDelete.Add(edge);
                    }
                }
            }

            foreach (var e in edgesToDelete)
            {
                DeleteEdge(e);
            }
        }
Exemplo n.º 26
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);
        }
Exemplo n.º 27
0
        public override SolvableConnection CreateConnection(UnitOperation uo, ProcessStreamBase ps, int ad)
        {
            ProcessStreamBaseControl ctrl = this.flowsheet.StreamManager.GetProcessStreamBaseControl(ps);
            SolvableConnection       conn = null;

            if (ad == Burner.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         = Burner.AIR_INLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetAirInConnectionPoint();
                PointOrientation uoOrientation = BurnerControl.AIR_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == Burner.FUEL_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         = Burner.FUEL_INLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetFuelInConnectionPoint();
                PointOrientation uoOrientation = BurnerControl.FUEL_INLET_ORIENTATION;
                ConnectionPoint  uoConnPoint   = new ConnectionPoint(uoIdx, uoName, uoPoint, uoOrientation);

                conn = new SolvableConnection(this.flowsheet, strConnPoint, uoConnPoint, ps.GetType());
            }
            else if (ad == Burner.FLUE_GAS_OUTLET_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         = Burner.FLUE_GAS_OUTLET_INDEX;
                string           uoName        = this.solvable.Name;
                Point            uoPoint       = this.GetFlueGasOutConnectionPoint();
                PointOrientation uoOrientation = BurnerControl.FLUE_GAS_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);
        }