Beispiel #1
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));
        }
Beispiel #2
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();
        }