Beispiel #1
0
 protected void OnStreamDetached(UnitOperation uo, ProcessStreamBase ps)
 {
     if (StreamDetached != null)
     {
         StreamDetached(uo, ps);
     }
 }
Beispiel #2
0
 protected void OnStreamAttached(UnitOperation uo, ProcessStreamBase ps, int streamIndex)
 {
     if (StreamAttached != null)
     {
         StreamAttached(uo, ps, streamIndex);
     }
 }
Beispiel #3
0
        private void QueueStreamsAndUnitOpsForErase(UnitOperation unitOp)
        {
            if (!eraseSolvableQueue.Contains(unitOp) && !unitOp.IsBeingExecuted)
            {
                eraseSolvableQueue.Enqueue(unitOp);
            }

            IList inletStreams = unitOp.InOutletStreams;

            foreach (ProcessStreamBase ps in inletStreams)
            {
                //if ps has already been queued go to next ps
                if (eraseSolvableQueue.Contains(ps))
                {
                    continue;
                }

                eraseSolvableQueue.Enqueue(ps);
                if (ps.UpStreamOwner != null && ps.UpStreamOwner != unitOp)
                {
                    QueueStreamsAndUnitOpsForErase(ps.UpStreamOwner);
                }
                if (ps.DownStreamOwner != null && ps.DownStreamOwner != unitOp)
                {
                    QueueStreamsAndUnitOpsForErase(ps.DownStreamOwner);
                }
            }
        }
Beispiel #4
0
        protected void OnUnitOpAdded(UnitOperation unitOp)
        {
            if (UnitOpAdded != null)
            {
                UnitOpAdded(unitOp);
            }

            OnSystemChanged();
        }
Beispiel #5
0
        public CrossSectionGeometry(CrossSectionType crossSectionType, UnitOperation owner) : base()
        {
            this.owner            = owner;
            this.crossSectionType = crossSectionType;
            diameter         = new ProcessVarDouble(StringConstants.DIAMETER, PhysicalQuantity.SmallLength, VarState.Specified, owner);
            width            = new ProcessVarDouble(StringConstants.WIDTH, PhysicalQuantity.Length, VarState.Specified, owner);
            height           = new ProcessVarDouble(StringConstants.HEIGHT, PhysicalQuantity.Length, VarState.Specified, owner);
            heightWidthRatio = new ProcessVarDouble(StringConstants.HEIGHT_WIDTH_RATIO, PhysicalQuantity.Unknown, VarState.Specified, owner);

            InitializeVarListAndRegisterVars();
        }
Beispiel #6
0
        public UnitOperation GetUnitOperation(string name)
        {
            UnitOperation retValue = null;
            ArrayList     unitOps  = GetUnitOpList();

            foreach (UnitOperation uo in unitOps)
            {
                if (uo.Name.Equals(name))
                {
                    retValue = uo;
                    break;
                }
            }
            return(retValue);
        }
Beispiel #7
0
        private void QueueStreamsAndUnitOpsForErase(ProcessStreamBase stream)
        {
            UnitOperation uo = stream.UpStreamOwner;

            if (uo != null && !eraseSolvableQueue.Contains(uo))
            {
                QueueStreamsAndUnitOpsForErase(stream.UpStreamOwner);
            }

            uo = stream.DownStreamOwner;
            if (uo != null && !eraseSolvableQueue.Contains(uo))
            {
                QueueStreamsAndUnitOpsForErase(stream.DownStreamOwner);
            }
        }
Beispiel #8
0
        private void QueueStreamsAndUnitOpsforForCalculate(ProcessStreamBase stream, bool specify)
        {
            //debug code
            Trace.WriteLine("Queue stream " + stream.Name);
            //debug code

            UnitOperation uo = stream.UpStreamOwner;

            if (uo != null && (specify || (!specify && !uo.HasSolvedAlready)) && !calculateUnitOpQueue.Contains(uo))
            {
                QueueStreamsAndUnitOpsForCalculate(stream.UpStreamOwner, specify);
            }

            uo = stream.DownStreamOwner;
            if (uo != null && (specify || (!specify && !uo.HasSolvedAlready)) && !calculateUnitOpQueue.Contains(stream.DownStreamOwner))
            {
                QueueStreamsAndUnitOpsForCalculate(stream.DownStreamOwner, specify);
            }
        }
Beispiel #9
0
        private void QueueStreamsAndUnitOpsForCalculate(UnitOperation unitOp, bool specify)
        {
            //debug code
            Trace.WriteLine("Queue unitOp " + unitOp.Name);
            //debug code

            //if (unitOp != currentUnitOp && !unitOp.AllDone && !calculateUnitOpQueue.Contains(unitOp)) {
            if (!unitOp.HasSolvedAlready && !calculateUnitOpQueue.Contains(unitOp) && !unitOp.IsBeingExecuted)
            {
                //calculateUnitOpQueue.Enqueue(unitOp);
                EnqueueCalculateUnitOp(unitOp);
            }
            if (!specify)
            {
                return;
            }

            IList inletStreams = unitOp.InOutletStreams;

            foreach (ProcessStreamBase ps in inletStreams)
            {
                //if ps has already been queued go to next ps
                if (calculateStreamQueue.Contains(ps))
                {
                    continue;
                }

                if (!ps.HasSolvedAlready && !calculateStreamQueue.Contains(ps))
                {
                    calculateStreamQueue.Enqueue(ps);
                }
                if (ps.UpStreamOwner != null && ps.UpStreamOwner != unitOp)
                {
                    QueueStreamsAndUnitOpsForCalculate(ps.UpStreamOwner, specify);
                }
                if (ps.DownStreamOwner != null && ps.DownStreamOwner != unitOp)
                {
                    QueueStreamsAndUnitOpsForCalculate(ps.DownStreamOwner, specify);
                }
            }
        }
Beispiel #10
0
        private void QueueStreamsAndUnitOpsForErase(Solvable solvable)
        {
            ProcessStreamBase ps = solvable as ProcessStreamBase;

            if (ps != null)
            {
                if (!eraseSolvableQueue.Contains(ps))
                {
                    eraseSolvableQueue.Enqueue(ps);
                }
                QueueStreamsAndUnitOpsForErase(ps);
            }
            else
            {
                UnitOperation uo = solvable as UnitOperation;
                if (uo != null && !eraseSolvableQueue.Contains(uo))
                {
                    QueueStreamsAndUnitOpsForErase(uo);
                }
            }
        }
Beispiel #11
0
        private void EnqueueCalculateUnitOp(UnitOperation unitOp)
        {
            UnitOperation aUnitOp;

            if (calculateUnitOpQueue.Count == 0)
            {
                calculateUnitOpQueue.Add(unitOp);
            }
            else
            {
                for (int i = calculateUnitOpQueue.Count - 1; i >= 0; i--)
                {
                    aUnitOp = calculateUnitOpQueue[i] as UnitOperation;
                    if (unitOp.SolvingPriority >= aUnitOp.SolvingPriority)
                    {
                        calculateUnitOpQueue.Insert(i + 1, unitOp);
                        return;
                    }
                }
                calculateUnitOpQueue.Insert(0, unitOp);
            }
        }
Beispiel #12
0
        private void QueueStreamsAndUnitOpsForCalculate(Solvable solvable, bool specify)
        {
            Trace.WriteLine("Queue solvable " + solvable.Name);

            if (solvable is ProcessStreamBase)
            {
                ProcessStreamBase ps = solvable as ProcessStreamBase;
                if (!ps.HasSolvedAlready)
                {
                    calculateStreamQueue.Enqueue(ps);
                }
                QueueStreamsAndUnitOpsforForCalculate(ps, specify);
            }
            else if (solvable is UnitOperation)
            {
                UnitOperation uo = solvable as UnitOperation;
                if (!calculateUnitOpQueue.Contains(uo))
                {
                    QueueStreamsAndUnitOpsForCalculate(uo, specify);
                }
            }
        }
Beispiel #13
0
 public CrossSectionGeometry(UnitOperation owner) :
     this(CrossSectionType.Circle, owner)
 {
 }