コード例 #1
0
        /// <summary>
        /// first save current txtbox values in substrateOld
        /// then show values of substrateNew in txtboxes
        /// </summary>
        /// <param name="substrateNew">new substrate, new selected substrate</param>
        /// <param name="substrateOld">old (previously) selected substrate</param>
        private void change_substrates_inTxtBoxes(substrate substrateNew, substrate substrateOld)
        {
            // falls sich was geändert hat, dann felder in aktuell ausgewähltes Substrat speichern
            if (substrateIsModified)
            {
                // save parameters in current substrate object

                // ist dieses Objekt ein Verweis auf das Objekt in der Liste? JA!!!
                // oder muss ich dieses Objekt wieder in die Liste rein schreiben? NEIN!!!
                // scheint so zu funktionieren

                save_TxtBoxValues_in_substrate(substrateOld);
            }

            // neues substrat anzeigen
            set_TxtBoxValues_to_substrate(substrateNew);

            // enable buttons - usually they are already enabled

            cmdAdd.Enabled   = true;
            cmdDel.Enabled   = true;
            cmdPrint.Enabled = true;

            // reset flag
            // mach das nicht, da datei ja weiterhin geändert ist, muss also gespeichert werden
            //substrateModified(false);
        }
コード例 #2
0
ファイル: GrpBoxPhys.cs プロジェクト: puttak/matlab_toolboxes
        // -------------------------------------------------------------------------------------
        //                            !!! PUBLIC METHODS !!!
        // -------------------------------------------------------------------------------------

        /// <summary>
        /// Set value of txtValue txtbox to param of mySubstrate
        /// </summary>
        /// <param name="mySubstrate">new substrate</param>
        public void setSubstrate(substrate mySubstrate)
        {
            this.mySubstrate = mySubstrate;

            physValue myValue = mySubstrate.get_params_of(param);

            txtValue.Text        = System.Xml.XmlConvert.ToString(myValue.Value);
            cmbUnit.SelectedItem = myValue.Unit;
        }
コード例 #3
0
ファイル: GrpBoxPhys.cs プロジェクト: puttak/matlab_toolboxes
        /// <summary>
        /// Standard constructor initializing the groupbox
        /// </summary>
        /// <param name="parentFrame">gui this GroupBox exists in</param>
        /// <param name="mySubstrate">substrate object which is represented by this grpboxtxt</param>
        /// <param name="param">substrate parameter which is represented by this grpboxtxt,
        /// must be referring to a physValue</param>
        /// <param name="mydelegate">function that is called when txtbox looses focus. can
        /// check the value on validity</param>
        /// <param name="xPos">x-coordinate of position of GroupBox</param>
        /// <param name="yPos">y-coordinate of position of GroupBox</param>
        /// <param name="helpText">text visualized as help while txtbox has focus</param>
        /// <param name="width">width of the GroupBox</param>
        /// <param name="height">height of the GroupBox</param>
        public GrpBoxPhys(gui_substrate parentFrame, substrate mySubstrate, String param,
                          LeaveDelegate mydelegate, int xPos, int yPos, String helpText, int width, int height)
            : this()
        {
            // save parameters in local fields

            this.mySubstrate = mySubstrate;
            this.param       = param;
            this.mydelegate  = mydelegate;
            this.helpText    = helpText;
            parent           = parentFrame;

            // get to be displayed param from substrate

            physValue myValue = mySubstrate.get_params_of(param);

            //

            ToolTip tt = new ToolTip();

            // set attributes of this GrpBoxTxt

            Bounds = new Rectangle(new Point(xPos, yPos), new Size(width, height));

            // set attributes of groupbox

            grpBox.Bounds = new Rectangle(new Point(0, 0), new Size(width, height));
            grpBox.Text   = myValue.Symbol + ":";

            tt.SetToolTip(grpBox, myValue.Label);

            // set attributes of textbox

            int cmb_width = 60; // width of combobox

            txtValue.Bounds = new Rectangle(new Point(6, 19),
                                            new Size(width - 4 - cmb_width - 6 - 6, height - 19 - 6));
            txtValue.Text = System.Xml.XmlConvert.ToString(myValue.Value);

            tt.SetToolTip(txtValue, myValue.Label);

            // set attributes of ComboBox for unit

            cmbUnit.Bounds = new Rectangle(new Point(width - cmb_width - 6, 18),
                                           new Size(cmb_width, height - 18 - 6));

            // TODO, hier sollte eine Liste eigefügt werden, welche dem Konstruktur
            // übergeben wird
            cmbUnit.Items.Add(myValue.Unit);

            cmbUnit.SelectedItem = myValue.Unit;

            tt.SetToolTip(cmbUnit, "unit");
        }
コード例 #4
0
        /// <summary>
        /// saves values in txt boxes in given substrate object
        /// only saves selected substrate class (EEG 2012), all others
        /// are saved directly after txtboxes are loosing focus, see
        /// grpboxtxt and phys
        /// </summary>
        /// <param name="mySubstrate">this substrate object is changed in this call
        /// </param>
        private void save_TxtBoxValues_in_substrate(substrate mySubstrate)
        {
            if (grpName == null)
            {
                return;
            }

            // wird mySubstrate so wirklich geändert?
            // oder muss ich mySubstrate auch wieder zurück geben?
            // das scheint so zu klappen

            //mySubstrate.set_params_of("name", grpName.getValue());
            //mySubstrate.set_params_of("id", grpID.getValue());

            //mySubstrate.set_params_of("cost", grpCost.getValueD());

            //mySubstrate.set_params_of("RP", grpRP.getValueD());
            //mySubstrate.set_params_of("RL", grpRL.getValueD());
            //mySubstrate.set_params_of("NDF", grpNDF.getValueD());
            //mySubstrate.set_params_of("ADF", grpADF.getValueD());
            //mySubstrate.set_params_of("ADL", grpADL.getValueD());

            //mySubstrate.set_params_of("TS", grpTS.getValueD());
            //mySubstrate.set_params_of("VS", grpVS.getValueD());
            //mySubstrate.set_params_of("D_VS", grpD_VS.getValueD());

            //mySubstrate.set_params_of("pH", grpPH.getValueD());
            //mySubstrate.set_params_of("Snh4", grpNH4.getValueD());
            //mySubstrate.set_params_of("TAC", grpTA.getValueD());
            //mySubstrate.set_params_of("T", grpT.getValueD());
            //mySubstrate.set_params_of("COD_S", grpCSBfil.getValueD());

            //mySubstrate.set_params_of("Sva",  grpSva.getValueD());
            //mySubstrate.set_params_of("Sbu",  grpSbu.getValueD());
            //mySubstrate.set_params_of("Spro", grpSpro.getValueD());
            //mySubstrate.set_params_of("Sac",  grpSac.getValueD());
            //mySubstrate.set_params_of("SIin", grpSI.getValueD());

            //mySubstrate.set_params_of("kdis", grpkdis.getValueD());
            //mySubstrate.set_params_of("khyd_ch", grpkhydch.getValueD());
            //mySubstrate.set_params_of("khyd_pr", grpkhydpr.getValueD());
            //mySubstrate.set_params_of("khyd_li", grpkhydli.getValueD());

            //mySubstrate.set_params_of("km_c4", grpkmc4.getValueD());
            //mySubstrate.set_params_of("km_pro", grpkmpro.getValueD());
            //mySubstrate.set_params_of("km_ac", grpkmac.getValueD());
            //mySubstrate.set_params_of("km_h2", grpkmh2.getValueD());

            mySubstrate.set_params_of("substrate_class", cmbSubstrateClass.SelectedItem.ToString());
        }
コード例 #5
0
        /// <summary>
        /// get substrate out of mySubstrates
        /// </summary>
        /// <param name="index">index of substrate: 0-based</param>
        /// <returns>substrate at given position</returns>
        private substrate get_substrate(int index)
        {
            substrate mySubstrate = new substrate();

            try
            {
                mySubstrate = mySubstrates.get(index + 1);
            }
            catch
            {
                MessageBox.Show(String.Format("Fehler beim Zugriff auf das Substrat {0}!", index),
                                "Substrat Zugriffsfehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(mySubstrate);
        }
コード例 #6
0
        /// <summary>
        /// set txtbox values to given substrate parameters
        /// </summary>
        /// <param name="mySubstrate">substrate</param>
        private void set_TxtBoxValues_to_substrate(substrate mySubstrate)
        {
            if (grpName == null)
            {
                return;
            }

            grpName.setSubstrate(mySubstrate);
            grpID.setSubstrate(mySubstrate);

            grpCost.setSubstrate(mySubstrate);

            grpRP.setSubstrate(mySubstrate);
            grpRL.setSubstrate(mySubstrate);
            grpNDF.setSubstrate(mySubstrate);
            grpADF.setSubstrate(mySubstrate);
            grpADL.setSubstrate(mySubstrate);

            grpTS.setSubstrate(mySubstrate);
            grpVS.setSubstrate(mySubstrate);
            grpD_VS.setSubstrate(mySubstrate);

            grpPH.setSubstrate(mySubstrate);
            grpNH4.setSubstrate(mySubstrate);
            grpTA.setSubstrate(mySubstrate);
            grpT.setSubstrate(mySubstrate);
            grpCSBfil.setSubstrate(mySubstrate);

            grpSva.setSubstrate(mySubstrate);
            grpSbu.setSubstrate(mySubstrate);
            grpSpro.setSubstrate(mySubstrate);
            grpSac.setSubstrate(mySubstrate);
            grpSI.setSubstrate(mySubstrate);

            grpkdis.setSubstrate(mySubstrate);
            grpkhydch.setSubstrate(mySubstrate);
            grpkhydpr.setSubstrate(mySubstrate);
            grpkhydli.setSubstrate(mySubstrate);

            grpkmc4.setSubstrate(mySubstrate);
            grpkmpro.setSubstrate(mySubstrate);
            grpkmac.setSubstrate(mySubstrate);
            grpkmh2.setSubstrate(mySubstrate);

            cmbSubstrateClass.SelectedItem = mySubstrate.get_param_of_s("substrate_class");
        }
コード例 #7
0
        /*====================         Click CALLBACKS         ====================*/

        /// <summary>
        /// add a new substrate to the list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            //

            // TODO - optionally show input dialog where you can add id and name
            // http://social.msdn.microsoft.com/Forums/windows/en-US/191ddf61-3ae5-4845-b852-56bb9b77238a/input-message-box-in-c


            //

            substrate mySubstrate = new substrate();

            if (mySubstrates == null)
            {
                mySubstrates = new substrates();
                lstSubstrates.Items.Clear();
            }

            mySubstrates.addSubstrate(mySubstrate);

            lstSubstrates.Items.Add(mySubstrate.name);

            // if no substrate was ever created
            if (grpName == null)
            {
                init_gui_with_substrate(mySubstrates);
            }
            // happens if list was empty, but before there was a substrate
            else if (sel_substrate == -1)
            {
                set_TxtBoxValues_to_substrate(mySubstrate);
            }

            // select the new entry which results in an event
            // if sel_substrate == -1 no event will occur, but correct substrate is
            // already visualized by call of set_TxtBox... above
            lstSubstrates.SelectedIndex = lstSubstrates.Items.Count - 1;

            // so no need to call this
            // change_substrates_inTxtBoxes(mySubstrate, get_sel_substrate());

            // enable buttons

            cmdDel.Enabled   = true;
            cmdPrint.Enabled = true;
        }
コード例 #8
0
        /// <summary>
        /// Standard constructor initializing the groupbox
        /// </summary>
        /// <param name="parentFrame">gui this GroupBox exists in</param>
        /// <param name="mySubstrate">substrate object which is represented by this grpboxtxt</param>
        /// <param name="param">substrate parameter which is represented by this grpboxtxt</param>
        /// <param name="mydelegate">function that is called when txtbox looses focus. can
        /// check the value on validity</param>
        /// <param name="xPos">x-coordinate of position of GroupBox</param>
        /// <param name="yPos">y-coordinate of position of GroupBox</param>
        /// <param name="id_unit">id + unit of physValue</param>
        /// <param name="label">label of physValue, is the title of the GroupBox</param>
        /// <param name="helpText">text visualized as help while txtbox has focus</param>
        /// <param name="width">width of the GroupBox</param>
        /// <param name="height">height of the GroupBox</param>
        public GrpBoxTxt(gui_substrate parentFrame, substrate mySubstrate, String param,
                         LeaveDelegate mydelegate, int xPos, int yPos,
                         String id_unit, String label, String helpText, int width, int height)
            : this()
        {
            // save parameters in local fields

            this.mySubstrate = mySubstrate;
            this.param       = param;
            this.mydelegate  = mydelegate;
            this.helpText    = helpText;
            parent           = parentFrame;


            // get to be displayed param from substrate

            String value = mySubstrate.get_param_of_s(param);

            //

            ToolTip tt = new ToolTip();

            // set attributes of this GrpBoxTxt

            Bounds = new Rectangle(new Point(xPos, yPos), new Size(width, height));

            // set attributes of groupbox

            grpBox.Bounds = new Rectangle(new Point(0, 0), new Size(width, height));
            grpBox.Text   = id_unit + ":";

            tt.SetToolTip(grpBox, label);

            // set attributes of txtBox

            txtValue.Bounds = new Rectangle(new Point(6, 19),
                                            new Size(width - 6 - 6, height - 19 - 6));
            txtValue.Text = value;

            tt.SetToolTip(txtValue, label);
        }
コード例 #9
0
ファイル: GrpBoxPhys.cs プロジェクト: puttak/matlab_toolboxes
 /// <summary>
 /// Standard constructor initializing the groupbox
 /// </summary>
 /// <param name="parentFrame">gui this GroupBox exists in</param>
 /// <param name="mySubstrate">substrate object which is represented by this grpboxtxt</param>
 /// <param name="param">substrate parameter which is represented by this grpboxtxt,
 /// must be referring to a physValue</param>
 /// <param name="mydelegate">function that is called when txtbox looses focus. can
 /// check the value on validity</param>
 /// <param name="xPos">x-coordinate of position of GroupBox</param>
 /// <param name="yPos">y-coordinate of position of GroupBox</param>
 /// <param name="helpText">text visualized as help while txtbox has focus</param>
 public GrpBoxPhys(gui_substrate parentFrame, substrate mySubstrate, String param,
                   LeaveDelegate mydelegate, int xPos, int yPos, String helpText)
     : this(parentFrame, mySubstrate, param, mydelegate, xPos, yPos, helpText, 120)
 {
 }
コード例 #10
0
ファイル: GrpBoxPhys.cs プロジェクト: puttak/matlab_toolboxes
 /// <summary>
 /// Standard constructor initializing the groupbox
 /// </summary>
 /// <param name="parentFrame">gui this GroupBox exists in</param>
 /// <param name="mySubstrate">substrate object which is represented by this grpboxtxt</param>
 /// <param name="param">substrate parameter which is represented by this grpboxtxt,
 /// must be referring to a physValue</param>
 /// <param name="xPos">x-coordinate of position of GroupBox</param>
 /// <param name="yPos">y-coordinate of position of GroupBox</param>
 public GrpBoxPhys(gui_substrate parentFrame, substrate mySubstrate, String param,
                   int xPos, int yPos)
     : this(parentFrame, mySubstrate, param, checkIfDouble, xPos, yPos, "")
 {
 }
コード例 #11
0
ファイル: Program.cs プロジェクト: puttak/matlab_toolboxes
        static void Main(string[] args)
        {
            physValue COD = biogas.chemistry.calcTOC("Xch");

            //physValueBounded mol_mass= new physValueBounded("Sac");

            //double a= 1;

            //physValueBounded c= a* mol_mass;

            fitness_params myparams = new fitness_params("fitness_params_geiger.xml");

            myparams.set_params_of("manurebonus", true);

            //double[] state= new double[37];

            //physValueBounded fostac= biogas.ADMstate.calcFOSTACOfADMstate(state);

            //physValue C;
            //physValue H;

            //physValue Hh2= biogas.chemistry.Hh2;

            //biogas.chemistry.get_CHONS_of("Sac_", out C, out H);

            //physValue ThODch= biogas.chemistry.calcTheoreticalOxygenDemand("Xch");

            //biogas.substrate.createMe();

            //double[] a= biogas.ADMstate.getDefaultADMstate(33);

            //double[] b= biogas.ADMstate.getDefaultADMstate(33);

            //a[33]= 10;
            //b[33]= 15;

            //double[,] c= new double[a.Length, 2];

            //for (int ii= 0; ii < a.Length; ii++)
            //{
            //  c[ii, 0]= a[ii];
            //  c[ii, 1]= b[ii];
            //}

            //double[] d= biogas.ADMstate.mixADMstreams(c);

            //biogas.substrate mySubstrate= new biogas.substrate("manure_cattle_1.xml");

            //mySubstrate.print();

            //mySubstrate= new biogas.substrate("wheat_silage_3.xml");

            //mySubstrate.print();

            substrates mySubstrates = new biogas.substrates("substrate_geiger.xml");

            mySubstrates.print();
            //mySubstrates.saveAsXML("test.xml");

            plant myPlant = new biogas.plant("plant_geiger.xml");
            //myPlant.saveAsXML("test_plant.xml");

            //double[] Q= {1,2,3,4,5,6,7};

            //myPlant.myDigesters.get("main").AD_Model.getParams(Q, mySubstrates);

            digester myDigester = myPlant.myDigesters.get(1);

            myDigester.calcHeatLossDueToRadiation(new physValue(40, "°C"));

            double[] Q           = { 15, 20, 0, 0, 0, 0, 0, 0, 0, 0 };
            double   QdigesterIn = 35;

            double[] ADMparams = myDigester.AD_Model.getParams(0, Q, QdigesterIn, mySubstrates);

            //double[] x= biogas.ADMstate.getDefaultADMstate();

//      double[] x= { 0.00890042014469482,
//0.00393026902393572,
//0.0898975418574202,
//0.0105303688871217,
//0.0188083338344299,
//0.0891872294599488,
//4.06518710070508,
//1.48197701713060e-06,
//0.0463395911897687,
//0.0137825768581825,
//0.231507824368968,
//3.42633334388719,
//8.90655977614532,
//0.129429796425159,
//0.0457772931408461,
//0.0271093313710146,
//3.81638964565446,
//0.988123176978798,
//0.410214653254316,
//0.633820130695941,
//0.537171143510719,
//1.81695029971744,
//0.992459517922010,
//8.07171990003056,
//19.9716874568380,
//0.000997039324889569,
//0.0155655622013352,
//0.0104958374141159,
//0.0187566838733815,
//0.0889172491178123,
//4.05462904506225,
//0.152623707143880,
//0.00590111878589172,
//8.13313521280990e-05,
//0.465153466604388,
//0.506049932143382,
//0.971284730099898
////8.05130545875131e-05,
////0.460473427139200,
////0.500958421870263,
////0.961512362064050
// };

            double[] x = { 0.00719913836418267,
                           0.00322799288019040,
                           0.0546025712168657,
                           0.0115793536955362,
                           0.0229074890746752,
                           0.0600482037552511,
                           0.463364086785563,
                           7.72721521995682e-08,
                           0.0469910866922296,
                           0.0479055807768373,
                           0.154317294840363,
                           -1.35975859128971e-47,
                           21.5301936374036,
                           0.750446550594154,
                           0.161739337648583,
                           0.0603411370260300,
                           4.96860324952978,
                           0.832215069627251,
                           0.222662822346057,
                           0.629071151058018,
                           0.547835241984119,
                           2.00168204821595,
                           1.05831074978528,
                           29.5159593610614,
                           1.79228974953266,
                           1.27233772322647e-52,
                           1.77592375955463e-55,
                           0.0115411203828431,
                           0.0228383440861995,
                           0.0598411508360539,
                           0.462166407598810,
                           0.2406363011183078,
                           0.00374878408176311,
                           4.31650348109949e-06,
                           0.476514182736779,
                           0.487815404290303,
                           0.964333903530564 };



            //biogas.sensors mySensors=
            //  new biogas.sensors(new biogas.VFA_TAC_sensor("1"));

            //physValue VFA_TAC= mySensors.getCurrentMeasurement("VFA_TAC_1", 2);

            //VFA_TAC= mySensors.measure(0, "VFA_TAC_1", 1, x);

            //VFA_TAC= mySensors.measure(2, "VFA_TAC_1", 1, x);

            biogas.sensors mySensors =
                new biogas.sensors(new biogas.TS_sensor("postdigester_3"));

            biogas.sensor_array mySensorArray = new biogas.sensor_array("Q");

            for (int isubstrate = 0; isubstrate < mySubstrates.getNumSubstrates(); isubstrate++)
            {
                mySensorArray.addSensor(new biogas.Q_sensor(mySubstrates.getID(isubstrate + 1)));
            }

            mySensorArray.addSensor(new biogas.Q_sensor("postdigester_digester"));

            mySensors.addSensorArray(mySensorArray);

            mySensors.addSensor(new biogas.substrate_sensor("cost"));

            mySensors.addSensor(new biogas.pumpEnergy_sensor("postdigester_digester"));

            mySensors.addSensor(new biogas.total_biogas_sensor("", myPlant));

            //physValue VFA_TACs= mySensors.measure(0, "VS_1", 1, new double[]{1,2}, mySubstrates);

            double[,] substrate_network = { { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 } };

            double[,] plant_network = { { 0, 1, 0 }, { 1, 0, 1 } };

            double TS;

            //mySensors.measure(0, "TS_digester_3", 1, x,
            //          myPlant, mySubstrates, mySensors,
            //          substrate_network, plant_network, "digester", out TS);


            mySensors.measure(0, "substrate_cost", 0, mySubstrates, out TS);
            mySensors.measure(1, "substrate_cost", 0, mySubstrates, out TS);
            mySensors.measure(2, "substrate_cost", 0, mySubstrates, out TS);

            double energy;

            double[] pump = { 5 };

            mySensors.measure(0, "pumpEnergy_postdigester_digester", 0, myPlant, 10, pump, out energy);

            double[] data;

            mySensors.getMeasurementStream("substrate_cost", out data);

            double[] u = new double[6];
            u[0] = 10;
            u[1] = 100;
            u[2] = 100;
            u[3] = 20;
            u[4] = 200;
            u[5] = 200;

            mySensors.measureVec(0, "total_biogas_", 0, myPlant, u, "threshold", 5);

            physValue Qgas_h2;
            physValue Qgas_ch4;
            physValue Qgas_co2;

            physValue T = new physValue("T", 41.4, "°C");

            biogas.ADMstate.calcBiogasOfADMstate(x, new physValue(3000, "m^3"),
                                                 T, out Qgas_h2, out Qgas_ch4, out Qgas_co2);

            double ph = biogas.ADMstate.calcPHOfADMstate(x);

            substrate mySubstrate = mySubstrates.get("swinemanure");

            biogas.ADMstate.calcADMstream(mySubstrate, 30);

            double mypH = mySubstrate.get_param_of("pH");
        }
コード例 #12
0
        /// <summary>
        /// prints selected substrate parameters to console
        /// only works if exe is called form matlab, dll is not working
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrint_Click(object sender, EventArgs e)
        {
            substrate mySubstrate = get_sel_substrate();

            Console.WriteLine(mySubstrate.print());
        }
コード例 #13
0
 /// <summary>
 /// Standard constructor initializing the groupbox
 /// with default width and height
 /// </summary>
 /// <param name="parentFrame">gui this GroupBox exists in</param>
 /// <param name="mySubstrate">substrate object which is represented by this grpboxtxt</param>
 /// <param name="param">substrate parameter which is represented by this grpboxtxt</param>
 /// <param name="mydelegate">function that is called when txtbox looses focus. can
 /// check the value on validity</param>
 /// <param name="xPos">x-coordinate of position of GroupBox</param>
 /// <param name="yPos">y-coordinate of position of GroupBox</param>
 /// <param name="id_unit">id + unit of physValue</param>
 /// <param name="label">label of physValue, is the title of the GroupBox</param>
 /// <param name="helpText">text visualized as help while txtbox has focus</param>
 public GrpBoxTxt(gui_substrate parentFrame, substrate mySubstrate, String param,
                  LeaveDelegate mydelegate, int xPos, int yPos,
                  String id_unit, String label, String helpText)
     : this(parentFrame, mySubstrate, param, mydelegate, xPos, yPos, id_unit, label, helpText, 120)
 {
 }
コード例 #14
0
        // -------------------------------------------------------------------------------------
        //                            !!! PUBLIC METHODS !!!
        // -------------------------------------------------------------------------------------

        /// <summary>
        /// Set value of txtValue txtbox to param of mySubstrate
        /// </summary>
        /// <param name="mySubstrate">new substrate</param>
        public void setSubstrate(substrate mySubstrate)
        {
            this.mySubstrate = mySubstrate;

            txtValue.Text = mySubstrate.get_param_of_s(param);
        }
コード例 #15
0
        // -------------------------------------------------------------------------------------
        //                            !!! PRIVATE METHODS !!!
        // -------------------------------------------------------------------------------------

        /// <summary>
        /// init gui with substrate fields
        ///
        /// creates the gui txtbox objects
        /// </summary>
        /// <param name="mySubstrates">list of substrates</param>
        /// <returns>true on success, else false</returns>
        private bool init_gui_with_substrate(substrates mySubstrates)
        {
            // fill list

            if (mySubstrates.Count == 0)
            {
                MessageBox.Show("Es ist kein Substrat in der Liste!", "Substratliste ist leer!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                return(false);
            }

            lstSubstrates.Items.Clear();

            foreach (substrate mySub in mySubstrates)
            {
                lstSubstrates.Items.Add(mySub.name);
            }

            //

            lstSubstrates.SelectedIndex = 0;

            // is also set in selectedIndexChanged event
            sel_substrate = 0;

            //

            substrate mySubstrate = get_sel_substrate();

            // general parameters

            grpName = new GrpBoxTxt(this, mySubstrate, "name", del_grpName, 6, 19,
                                    strings.substrate_name, strings.substrate_name_tt);
            grpID = new GrpBoxTxt(this, mySubstrate, "id", del_grpID, 132, 19,
                                  strings.substrate_id, strings.substrate_id_tt);

            grpCost = new GrpBoxPhys(this, mySubstrate, "cost", 258, 19);

            // weender analysis

            grpRP  = new GrpBoxPhys(this, mySubstrate, "RP", 6, 19);
            grpRL  = new GrpBoxPhys(this, mySubstrate, "RL", 132, 19);
            grpNDF = new GrpBoxPhys(this, mySubstrate, "NDF", 258, 19);
            grpADF = new GrpBoxPhys(this, mySubstrate, "ADF", 384, 19);
            grpADL = new GrpBoxPhys(this, mySubstrate, "ADL", 510, 19);

            // chemical and physical parameters

            grpTS   = new GrpBoxPhys(this, mySubstrate, "TS", 6, 19);
            grpVS   = new GrpBoxPhys(this, mySubstrate, "VS", 132, 19);
            grpD_VS = new GrpBoxPhys(this, mySubstrate, "D_VS", 258, 19);

            grpPH     = new GrpBoxPhys(this, mySubstrate, "pH", 6, 70);
            grpNH4    = new GrpBoxPhys(this, mySubstrate, "Snh4", 132, 70);
            grpTA     = new GrpBoxPhys(this, mySubstrate, "TAC", 258, 70);
            grpT      = new GrpBoxPhys(this, mySubstrate, "T", 384, 70);
            grpCSBfil = new GrpBoxPhys(this, mySubstrate, "COD_S", 510, 70);

            grpSva  = new GrpBoxPhys(this, mySubstrate, "Sva", 6, 121);
            grpSbu  = new GrpBoxPhys(this, mySubstrate, "Sbu", 132, 121);
            grpSpro = new GrpBoxPhys(this, mySubstrate, "Spro", 258, 121);
            grpSac  = new GrpBoxPhys(this, mySubstrate, "Sac", 384, 121);
            grpSI   = new GrpBoxPhys(this, mySubstrate, "SIin", 510, 121);

            // model parameters

            grpkdis   = new GrpBoxPhys(this, mySubstrate, "kdis", 6, 19);
            grpkhydch = new GrpBoxPhys(this, mySubstrate, "khyd_ch", 132, 19);
            grpkhydpr = new GrpBoxPhys(this, mySubstrate, "khyd_pr", 258, 19);
            grpkhydli = new GrpBoxPhys(this, mySubstrate, "khyd_li", 384, 19);

            grpkmc4  = new GrpBoxPhys(this, mySubstrate, "km_c4", 6, 70);
            grpkmpro = new GrpBoxPhys(this, mySubstrate, "km_pro", 132, 70);
            grpkmac  = new GrpBoxPhys(this, mySubstrate, "km_ac", 258, 70);
            grpkmh2  = new GrpBoxPhys(this, mySubstrate, "km_h2", 384, 70);

            //

            cmbSubstrateClass.SelectedItem = mySubstrate.get_param_of_s("substrate_class");

            // add grpboxes to surrounding groupboxes

            grpGeneral.Controls.Add(grpName);
            grpGeneral.Controls.Add(grpID);
            grpGeneral.Controls.Add(grpCost);

            grpWeender.Controls.Add(grpRP);
            grpWeender.Controls.Add(grpRL);
            grpWeender.Controls.Add(grpNDF);
            grpWeender.Controls.Add(grpADF);
            grpWeender.Controls.Add(grpADL);

            grpPhys.Controls.Add(grpTS);
            grpPhys.Controls.Add(grpVS);
            grpPhys.Controls.Add(grpD_VS);

            grpPhys.Controls.Add(grpPH);
            grpPhys.Controls.Add(grpNH4);
            grpPhys.Controls.Add(grpTA);
            grpPhys.Controls.Add(grpT);
            grpPhys.Controls.Add(grpCSBfil);

            grpPhys.Controls.Add(grpSva);
            grpPhys.Controls.Add(grpSbu);
            grpPhys.Controls.Add(grpSpro);
            grpPhys.Controls.Add(grpSac);
            grpPhys.Controls.Add(grpSI);

            grpModel.Controls.Add(grpkdis);
            grpModel.Controls.Add(grpkhydch);
            grpModel.Controls.Add(grpkhydpr);
            grpModel.Controls.Add(grpkhydli);

            grpModel.Controls.Add(grpkmc4);
            grpModel.Controls.Add(grpkmpro);
            grpModel.Controls.Add(grpkmac);
            grpModel.Controls.Add(grpkmh2);


            // enable command buttons

            cmdAdd.Enabled   = true;
            cmdDel.Enabled   = true;
            cmdPrint.Enabled = true;

            return(true);
        }