Esempio n. 1
0
        private double updateCoolingPower()
        {
            state = simulator.State;
            Cooler cooler = null;

            for (int i = 0; i < coolers.Length; i++)
            {
                if (coolers[i].Name == state.coolerName)
                {
                    cooler = coolers[i];
                    break;
                }
            }
            if (cooler == null)
            {
                string msg = string.Format("Can't find cooler \"{0}\"", state.coolerName);
                throw new Exception(msg);
            }
            double[] x   = new double[2];
            double[] y   = new double[2];
            double   max = cooler.CPM[1].data;

            x[0] = 300 - (300 - cooler.CPM[0].temp) * state.powerFactor;
            x[1] = 300;
            for (int i = 0; i < 2; i++)
            {
                y[i] = cooler.OutputPower(cooler.CPM[i].temp, state.powerFactor);
            }


            LinePlot lp = new LinePlot();

            lp.Pen          = Pens.Orange;
            lp.AbscissaData = x;
            lp.OrdinateData = y;

            plot.Add(lp, PlotSurface2D.XAxisPosition.Bottom, PlotSurface2D.YAxisPosition.Right);

            return(max);
        }
Esempio n. 2
0
        //private void plotOutputPower() {
        //    Cooler cooler = (Cooler)coolersListBox.SelectedItem;
        //    if (cooler == null) {
        //        return;
        //    }

        //    double powerFactor = getPowerFactor();
        //    double yMax = 0.0;

        //    double[] x = new double[cooler.CPM.Count];
        //    double[] y = new double[cooler.CPM.Count];
        //    for (int i = 0; i < cooler.CPM.Count; i++) {
        //        if (cooler.CPM[i].data > yMax) {
        //            yMax = cooler.CPM[i].data;
        //        }
        //        x[i] = 300.0 - (300.0 - cooler.CPM[i].temp) * powerFactor;
        //        y[i] = cooler.CPM[i].data * powerFactor;
        //    }

        //    coolerVisualizer.XAxisLabel = "Temp (Deg K)";
        //    coolerVisualizer.YAxisLabel = "Output Cooling Power";
        //    coolerVisualizer.PlotLabel = cooler.Name;
        //    coolerVisualizer.XData = x;
        //    coolerVisualizer.YData = y;
        //    coolerVisualizer.Y_Max = yMax;

        //    coolerVisualizer.Redraw();
        //}

        private void plotOutputPower()
        {
            Cooler cooler = (Cooler)coolersListBox.SelectedItem;

            if (cooler == null)
            {
                return;
            }

            double powerFactor = getPowerFactor();
            double yMax        = 0.0;

            double[] x = new double[301];
            double[] y = new double[301];

            for (int i = 0; i <= 300; i++)
            {
                x[i] = (double)i;
                y[i] = cooler.OutputPower(x[i], powerFactor);
                if (y[i] < 0.0)
                {
                    y[i] = 0.0;
                }
                if (y[i] > yMax)
                {
                    yMax = y[i];
                }
            }

            coolerVisualizer.XAxisLabel = "Temp (Deg K)";
            coolerVisualizer.YAxisLabel = "Cooling Power (Watts)";
            coolerVisualizer.PlotLabel  = cooler.Name;
            coolerVisualizer.XData      = x;
            coolerVisualizer.YData      = y;
            coolerVisualizer.Y_Max      = cooler.MaxOutputPower;

            coolerVisualizer.Redraw();
        }