void updateParamSummary()
        {
            TextParamList textList  = controlParams.getText();
            TextBlock     textBlock = new TextBlock();
            string        s;

            double rowHeight = 1.2 * textBlock.FontSize;
            double colWidth  = 10 * rowHeight;

            int ncols  = 2;
            int nlines = textList.getNLines();
            int nrows  = (int)Math.Ceiling((float)nlines / ncols);
            int coli   = 0;
            int linei  = 0;

            paramGrid.Children.Clear();
            foreach (TextParam param in textList)
            {
                if (param.isHeader && linei > 0)
                {
                    linei++;
                    if (linei >= nrows)
                    {
                        coli++;
                        linei = 0;
                    }
                }

                s = param.name;
                if (param.value != "" || param.units != "")
                {
                    s += "\t";
                    if (param.value != "")
                    {
                        s += param.value;
                    }
                    if (param.units != "")
                    {
                        s += " " + param.units;
                    }
                }
                addParamText(s, coli * colWidth, linei * rowHeight, param.isHeader);

                linei++;
                if (linei >= nrows)
                {
                    coli++;
                    linei = 0;
                }
            }
        }
示例#2
0
        public TextParamList getInParams()
        {
            TextParamList textList = null;

            if (model != null)
            {
                if (model.model != null)
                {
                    if (model.model.inParams != null)
                    {
                        textList = model.model.inParams.getText(true);
                    }
                }
            }
            return(textList);
        }
示例#3
0
        public ReportWindow(double width, double height, TextParamList inParamList, string outParams)
        {
            InitializeComponent();

            chromPage           = new ChromPage(width, height, new DateTime(), ChromPageContent.Params, 0, 0);
            chromPage.canvas    = reportCanvas;
            reportCanvas.Width  = width;
            reportCanvas.Height = height;
            chromPage.createReport(inParamList, outParams);

            report = inParamList.ToString();
            if (outParams != "")
            {
                if (report != "")
                {
                    report += "\n";
                }
                report += "Output parameters\n";
                report += outParams.Replace("<b>", "").Replace("</b>", "");
            }
        }
示例#4
0
        public void createReport(TextParamList inparams, string outparams)
        {
            double avgsize = Math.Sqrt(Width * Height);
            bool   bold = false;
            bool   boldEnded = false;
            int    nlines = 0;
            int    ncols = 3;
            int    nrows = 0;
            double x, y;

            fontSize = 0.015 * avgsize;
            double rowSize = 1.6 * fontSize;
            double colSize = 8 * fontSize;

            if (inparams != null)
            {
                nlines = inparams.getNLines();
                nrows  = (int)Math.Ceiling((float)nlines / ncols);
                int    coli     = 0;
                int    linei    = 0;
                double colWidth = Width / ncols;

                foreach (TextParam param in inparams)
                {
                    if (param.isHeader && linei > 0)
                    {
                        linei++;
                        if (linei >= nrows)
                        {
                            coli++;
                            linei = 0;
                        }
                    }

                    x = coli * colWidth;
                    y = linei * rowSize;
                    addText(param.name, x, y, param.isHeader);

                    x += colSize;
                    addText(param.value, x, y);

                    x += colSize;
                    addText(param.units, x, y);

                    linei++;
                    if (linei >= nrows)
                    {
                        coli++;
                        linei = 0;
                    }
                }

                for (x = 1; x < ncols; x++)
                {
                    addLine(x * colWidth, 0, x * colWidth, nrows * rowSize);
                }
                addLine(0, 0, Width, 0);
                addLine(0, nrows * rowSize, Width, nrows * rowSize);
            }

            if (outparams != "")
            {
                int      row = nrows;
                int      col = 0;
                string[] lines;
                string[] parts;
                string   part;

                addText("Output parameters", 0, row * rowSize, true);
                row++;

                lines = outparams.Split('\n');

                if (lines.Length > 0)
                {
                    // set columns size by dividing total width over number of columns
                    ncols   = lines[0].Split('\t').Length;
                    colSize = Width / ncols;
                }

                foreach (string line in lines)
                {
                    parts = line.Split('\t');
                    foreach (string part0 in parts)
                    {
                        part = part0;
                        if (part.StartsWith("<b>"))
                        {
                            bold = true;
                        }
                        else if (part.StartsWith("</b>"))
                        {
                            bold = false;
                        }
                        else if (part.EndsWith("</b>"))
                        {
                            boldEnded = true;
                        }
                        part = part.Replace("<b>", "");
                        part = part.Replace("</b>", "");

                        addText(part, col * colSize, row * rowSize, bold);

                        if (boldEnded)
                        {
                            boldEnded = false;
                            bold      = false;
                        }

                        col++;
                    }
                    row++;
                    col = 0;
                }
            }
        }
示例#5
0
        public TextParamList getText(bool showAll = false)
        {
            TextParamList textList = new TextParamList();
            string        units, compLabel;

            // Main
            if (showAll)
            {
                textList.addHeader("Main parameters");
                textList.add("Profile", Util.GetEnumDescription(profile));
                textList.add("Model", model.ToString());
                textList.add("Run mode", Util.GetEnumDescription(runMode));
                textList.add("K definition", Util.GetEnumDescription(kDefinition));
            }

            // Column
            textList.addHeader("Column parameters");
            textList.add("Vc", vc.ToString(), volUnits.ToString());
            if (vdeadInEnabled)
            {
                textList.add("Vdead in", vdeadIn.ToString(), volUnits.ToString());
            }
            if (vdeadOutEnabled)
            {
                textList.add("Vdead out", vdeadOut.ToString(), volUnits.ToString());
            }
            if (vdeadInjectEnabled)
            {
                textList.add("Vdead inject", vdeadInject.ToString(), volUnits.ToString());
            }
            textList.add("Uf", uf.ToString(), "0..1");
            textList.add("Lf", lf.ToString(), "0..1");

            // Flow
            textList.addHeader("Flow parameters");
            units = string.Format("{0}/{1}", volUnits, timeUnits);
            if (fu != 0)
            {
                textList.add("Fu", fu.ToString(), units);
            }
            if (fl != 0)
            {
                textList.add("Fl", fl.ToString(), units);
            }
            if (eeMode != EEModeType.None)
            {
                textList.add(Util.GetEnumDescription(eeMode));
            }
            if (runMode == RunModeType.Intermittent)
            {
                textList.add("start phase", intStartPhase.ToString());
                if (intMode == IntModeType.Component)
                {
                    if (intUpComp >= 0 && intUpComp < comps.Count)
                    {
                        compLabel = comps[intUpComp].label;
                    }
                    else
                    {
                        compLabel = "-";
                    }
                    textList.add("Upper switch", compLabel);

                    if (intLpComp >= 0 && intLpComp < comps.Count)
                    {
                        compLabel = comps[intLpComp].label;
                    }
                    else
                    {
                        compLabel = "-";
                    }
                    textList.add("Lower switch", compLabel);
                }
                else if (intMode == IntModeType.Volume)
                {
                    textList.add("Upper switch", intUpSwitch.ToString(), volUnits.ToString());
                    textList.add("Lower switch", intLpSwitch.ToString(), volUnits.ToString());
                }
                else
                {
                    textList.add("Upper switch", intUpSwitch.ToString(), timeUnits.ToString());
                    textList.add("Lower switch", intLpSwitch.ToString(), timeUnits.ToString());
                }
                textList.add("Max iterations", intMaxIt.ToString());
                if (intFinalElute)
                {
                    textList.add("Final elution");
                }
            }

            // Inject
            textList.addHeader("Inject parameters");
            textList.add("Inject mode", injectMode.ToString());
            textList.add("Inject phase", injectPhase.ToString());
            textList.add("Inject volume", injectVolume.ToString(), volUnits.ToString());
            textList.add("Inject position", injectPos.ToString(), "0..1");
            if (injectMode == InjectModeType.Batch)
            {
                if (injectFeedUnits == QuantityType.Volume)
                {
                    units = volUnits.ToString();
                }
                else if (injectFeedUnits == QuantityType.Time)
                {
                    units = timeUnits.ToString();
                }
                textList.add("Inject feed", injectFeed.ToString(), units);
            }

            // Model
            textList.addHeader("Model parameters");
            if (model == ModelType.CCD || model == ModelType.Transport)
            {
                textList.add("Steps", column.ToString());
            }
            if (model == ModelType.Probabilistic)
            {
                units = string.Format("1/{0}", timeUnits);
                textList.add("Rotational speed", mixSpeed.ToString(), units);
            }
            if (model == ModelType.CCD || model == ModelType.Probabilistic)
            {
                textList.add("Efficiency", Util.toString(efficiency, 4), "0..1");
            }
            if (model == ModelType.Transport)
            {
                textList.add("Mass transfer", ka.ToString());
            }
            return(textList);
        }