Exemple #1
0
        //Does the calculations
        public static void calcDelta()
        {
            //Calculated the molekular change of H, G and S
            //Sort.calcDelta();
            reacSum = prodSum = 0;
            for (int q = elmnts.Count - 1; q >= 0; q--)
            {
                if (q<arrowAt)
                {
                    reacSum += elmnts[q].H* elmnts[q].mult;
                }
                else
                {
                    prodSum += elmnts[q].H* elmnts[q].mult;
                }
            }
            deltH = prodSum - reacSum;

            reacSum = prodSum = 0;
            for (int q = elmnts.Count - 1; q >= 0; q--)
            {
                if (q<arrowAt)
                {
                    reacSum += elmnts[q].G* elmnts[q].mult;
                }
                else
                {
                    prodSum += elmnts[q].G* elmnts[q].mult;
                }
            }
            deltG = prodSum - reacSum;

            reacSum = prodSum = 0;
            for (int q = elmnts.Count - 1; q >= 0; q--)
            {
                if (q<arrowAt)
                {
                    reacSum += elmnts[q].S* elmnts[q].mult;
                }
                else
                {
                    prodSum += elmnts[q].S* elmnts[q].mult;
                }
            }
            deltS = prodSum - reacSum;

            //Δ
            Data.WriteLine(line);
            Data.Write("Name:\t");
            foreach (Element e in elmnts)
            {
                Data.Write("|" + e.search + "\t\t");
            }
            Data.WriteLine();
            Data.Write("H:\t");
            foreach (Element e in elmnts)
            {
                if (e.foundH)
                {
                    Data.Write("|" + e.H + "\t\t");
                }
                else
                {
                    Data.Write("|MISSING!");
                }
            }
            Data.WriteLine();
            Data.Write("G:\t");
            foreach (Element e in elmnts)
            {
                if (e.foundG)
                {
                    Data.Write("|" + e.G + "\t\t");
                }
                else
                {
                    Data.Write("|MISSING!");
                }
            }
            Data.WriteLine();
            Data.Write("S:\t");
            foreach (Element e in elmnts)
            {
                if (e.foundS)
                {
                    Data.Write("|" + e.S + "\t\t");
                }
                else
                {
                    Data.Write("|MISSING!");
                }
            }

            //Devided by thousand because the unit needs to be kJ, but is J.
            deltGT = (deltH - (Main.ThisForm.getTemp() * deltS / 1000));

            Data.WriteLine();
            Data.WriteLine(line);
            Data.WriteLine("ΔHᴼ=" + deltH + "kJ/Mol");
            Data.WriteLine("ΔGᴼ=" + deltG + "kJ/Mol");
            Data.WriteLine("ΔG =" + deltGT + "kJ/Mol");
            Data.WriteLine("ΔSᴼ=" + deltS + "J/(Mol*K)");
            Data.WriteLine(line);

            Main.ThisForm.setH(deltH);
            Main.ThisForm.setG(deltG);
            Main.ThisForm.setS(deltS);
            Main.ThisForm.setGT(deltGT);

            Equlibrium.calcK(elmnts, arrowAt);
        }
Exemple #2
0
 private void DeltaG_TextChanged(object sender, EventArgs e)
 {
     Equlibrium.calcK(Delta.elmnts, Delta.arrowAt);
 }