예제 #1
0
        public int GetMaxTemp(PinchDataModels model, int type)
        {
            for (int i = 1; i <= 100; i++)
            {
                model.Approach = i;
                if (type == 0)
                {
                    postStreams((StreamModel)model);
                }
                else
                {
                    postExchangers((ExchangerModel)model);
                }

                List <Interval> interval = new List <Interval>();
                List <Net>      net      = new List <Net>();
                getPinchPoint   trial    = new getPinchPoint(Streams, UtilityStreams, interval, net, model.Approach, model.Units, this.formNumber);
                trial.getCurrentDuties();
                if (trial.TAppLimitReached())
                {
                    Streams.Clear();
                    UtilityStreams.Clear();
                    return(i);
                }
                Streams.Clear();
                UtilityStreams.Clear();
            }
            return(100);
        }
예제 #2
0
        public double getQh(double approach, List <PinchAnalysis_DLL.NormalStream> streams)
        {
            List <PinchAnalysis_DLL.NormalStream> NewStreams = ExtensionMethods.CloneStreamsWithNewApproach(streams, approach);
            List <Interval> trialInterval = new List <Interval>();
            List <Net>      trialNet      = new List <Net>();
            getPinchPoint   trial         = new getPinchPoint(NewStreams, UtilityStreams, trialInterval, trialNet, approach, NewStreams[0].Units, this.formNumber);

            if (approach == 1)
            {
                trial.getCurrentDuties();
                CurrentQh = trial.CurrentQh;
            }
            return(Math.Abs(CurrentQh - Math.Abs(trial.Qh)));
        }
예제 #3
0
        public void CalculateCurrentApproach(StreamModel model, int type)
        {
            MaxApproach = GetMaxTemp(model, type);

            for (int i = 1; i <= MaxApproach; i++)
            {
                getPinchPoint trial = PinchFun(model, i, type);
                trial.getCurrentDuties();
                if (trial.Qh == trial.CurrentQc)
                {
                    trial.CurrentApproach = i;
                }
            }
        }
예제 #4
0
        public IHttpActionResult postStreamsOptimize(StreamModel model)
        {
            MaxApproach = GetMaxTemp(model, 0);

            List <CostCalc> CostCalcList  = new List <CostCalc>();
            List <Point>    CAPEXLine     = new List <Point>();
            List <Point>    OPEXLine      = new List <Point>();
            List <Point>    TotalCostLine = new List <Point>();

            for (int i = 1; i <= MaxApproach; i++)
            {
                getPinchPoint trial = PinchFun(model, i, 0);

                double?HotUtilityCostPerHour  = trial.UtilityStreams.Where(a => a.GetType() == typeof(PinchAnalysis_DLL.HotUtilityStream)).Sum(a => a.OptimiumDuty * a.Cost);
                double?ColdUtilityCostPerHour = trial.UtilityStreams.Where(a => a.GetType() == typeof(PinchAnalysis_DLL.ColdUtilityStream)).Sum(a => a.OptimiumDuty * a.Cost);

                var cold = trial.UtilityStreams.Where(a => a.GetType() == typeof(PinchAnalysis_DLL.ColdUtilityStream));


                CostCalc row = new CostCalc(trial.MaxHeatRecovery, trial.Get_Optimium_UA() / 1000000, model.DollarPerUA, model.LifeTime, HotUtilityCostPerHour, ColdUtilityCostPerHour);
                CostCalcList.Add(row);
                CAPEXLine.Add(new Point(i, row.HourlyCAPEX));
                OPEXLine.Add(new Point(i, row.TotalOPEX));
                TotalCostLine.Add(new Point(i, row.TotalCost));


                Streams.Clear();
                UtilityStreams.Clear();
            }

            var   OptimumTotalCost = TotalCostLine.OrderBy(a => a.y).FirstOrDefault();
            Point OptimumT         = new Point(OptimumTotalCost.x, OptimumTotalCost.y);

            dynamic obj = new ExpandoObject();

            obj.CAPEXLine     = CAPEXLine;
            obj.OPEXLine      = OPEXLine;
            obj.TotalCostLine = TotalCostLine;
            obj.OptimumT      = OptimumT;

            return(Ok(obj));
        }
예제 #5
0
        public IHttpActionResult Calculate(List <PinchAnalysis_DLL.NormalStream> streams, List <PinchAnalysis_DLL.UtilityStream> UtilityStreams, double ApproachTemp)
        {
            List <Interval> interval = new List <Interval>();
            List <Net>      net      = new List <Net>();

            if (CurrentApproach == -1)
            {
                CurrentApproach = Bisection(1, 100, 0.01, streams);
            }
            getPinchPoint getPinch = new getPinchPoint(streams, UtilityStreams, interval, net, ApproachTemp, streams[0].Units, this.formNumber);

            getPinch.drawGccDiagram();
            getPinch.drawHTDiagram();
            getPinch.drawGridDiagram();
            getPinch.getCurrentDuties();
            getPinch.getCurrentDutiesPerUtility();
            getPinch.CurrentApproach = CurrentApproach;
            Solution answer = getPinch.Answer();

            return(Ok(answer));
        }
예제 #6
0
        public getPinchPoint PinchFun(PinchDataModels model, int approach, int type)
        {
            model.Approach = approach;
            if (type == 0)
            {
                postStreams((StreamModel)model);
            }
            else
            {
                postExchangers((ExchangerModel)model);
            }

            List <Interval> interval = new List <Interval>();
            List <Net>      net      = new List <Net>();
            getPinchPoint   trial    = new getPinchPoint(Streams, UtilityStreams, interval, net, model.Approach, model.Units, this.formNumber);

            trial.getCurrentDuties();
            trial.drawGccDiagram();
            trial.drawHTDiagram();
            return(trial);
        }
예제 #7
0
        private void btn_submit_Click(object sender, EventArgs e)
        {
            int           H       = panelHot.Controls.Count / 4;
            int           C       = panelCold.Controls.Count / 4;
            List <Stream> Streams = new List <Stream>();
            var           appr    = double.Parse(txt_appTemp.Text);

            for (int i = 0; i < H; i++)
            {
                var    j    = i + 1;
                string s    = "Hot_Supply" + j.ToString();
                var    d    = panelHot.Controls;
                var    supp = double.Parse(((TextBox)panelHot.Controls["Hot_Supply" + j.ToString()]).Text);
                var    targ = double.Parse(((TextBox)panelHot.Controls["Hot_Target" + j.ToString()]).Text);;
                var    duty = double.Parse(((TextBox)panelHot.Controls["Hot_Duty" + j.ToString()]).Text);;
                Streams.Add(new hotStream(appr, supp, targ, duty));
            }

            for (int i = 0; i < C; i++)
            {
                var j    = i + 1;
                var supp = double.Parse(((TextBox)panelCold.Controls["Cold_Supply" + j.ToString()]).Text);
                var targ = double.Parse(((TextBox)panelCold.Controls["Cold_Target" + j.ToString()]).Text);;
                var duty = double.Parse(((TextBox)panelCold.Controls["Cold_Duty" + j.ToString()]).Text);;
                Streams.Add(new coldStream(appr, supp, targ, duty));
            }

            List <Interval> interval = new List <Interval>();
            List <Net>      net      = new List <Net>();
            getPinchPoint   trial    = new getPinchPoint(Streams, interval, net, appr);

            Interval answer = trial.Answer();

            txt_t.Text     = answer.IntervalTemp.ToString();
            txt_tHot.Text  = answer.HotInterval.ToString();
            txt_tCold.Text = answer.ColdInterval.ToString();
        }