Engine brake calculator for Windows

Discuss or share your car-related work here

Moderator: kilo

Engine brake calculator for Windows

Postby jaItX7FC » Sun Nov 11, 2012 4:17 am

I believe most of you use Octave?

I tried to download it, download with my slow connection took long and failed often, so as it was downloading I thought that I try to practice C# programming, I know very little of it, but I try to learn.

As of result, before download was finished I had C# app, that does same as Octave app, I did verify by Octave app that I get same results and also added another feature so one gets directly both engine braking values, but mostly it does just the same as Kakuri's enginebrake.m.

I know that this has probably much use, but as got it working, why not to share, maybe someone using Windows might find it useful.

216kb file:

I would like to make program bit better, improve source code as I know it is not the very best way done, but maybe some day.

I'm working with readme too, here is current version of it.
Code: Select all
Engine brake calculator 11.11.2012

Calculates car's engine braking parameters for open source car simulator Speed Dreams

My first application, might be riddled with bugs, gremlins and daemons, beware. Any damage to
you or your equipment I'm not responsible for, so use at your own risk.
However it should not really harm anything as all it does is read and write values to text boxes and do little maths.

This is based on Octave program located here:

So credits go to Kakuri and everyone else who is involved with that.

I did simply convert code for C#

Requirements: .NET, I guess 2.5 should be enough, however installer should install required parts if not present in computer.
Coded in Microsoft Visual C# 2008 in WinXP, english language .NET installed, I have no possibility to test in other systems so
send feedback if it does work for you.

Contact: f4b539d4_at_opayq.com

Very ugly and perhaps buggy source is like this, well part of source that does what it is made to do, this is my first real app and first ever I share, so you can imagine how it is not very perfect, I can barely stand and I try to run...:
Code: Select all
        double Vengine;
        double L;
        double Ncyl;
        double rc;
        double Vin;
        double mIn = Convert.ToDouble(135.968);
        double k = 1.4;
        double p0 = 100000;
        double c;
        double Vd;
        double Vc;
        double MaxTq;

private void button1_Click(object sender, EventArgs e)
            Vengine = 0;
            string Venginet;
            Venginet = textBox_Vengine.Text;
            Vengine = Convert.ToDouble(Venginet);

            L = 0;
            string Lt;
            Lt = textBox_L.Text;
            L = Convert.ToDouble(Lt);

            Ncyl = 0;
            string Ncylt;
            Ncylt = textBox_Ncyl.Text;
            Ncyl = Convert.ToDouble(Ncylt);

            rc = 0;
            string rct;
            rct = textBox_rc.Text;
            rc = Convert.ToDouble(rct);

            Vin = 0;
            string Vint;
            Vint = textBox_Vin.Text;
            Vin = Convert.ToDouble(Vint);

            c = 0;
            Vd = 0;
            Vc = 0;

            c = 1-k;
            Vd = Vengine/Ncyl;
            Vc = Vd / (rc - 1);

            double LinBrakeCoeff;
            LinBrakeCoeff = Vengine * L * mIn;
            textBox2.Text = Convert.ToString(LinBrakeCoeff);

            double ConTorque;
            ConTorque = ((Ncyl / c) * ((Vc + Vin / rc) / (Math.Pow((Vin + Vc), c))) * (Math.Pow((Vin + Vc + Vd), c) - Math.Pow((Vin + Vc), c)) - Vengine) * p0 / (4 * Math.PI);
            //ConTorque = ((Ncyl/c)*((Vc+Vin/rc)/Math.Pow((Vin+Vc),c))*(Math.Pow((Vin+Vc+Vd),c)-Math.Pow((Vin+Vc),c))-Vengine)*p0/(4*Math.PI);
            textBox1.Text = Convert.ToString(ConTorque);

            double ConTorqueP = Math.Abs(ConTorque);
            MaxTq = 0;
            MaxTq = Convert.ToDouble(textBoxMaxTq.Text);
            double brakecoeff;
            brakecoeff = (ConTorqueP / MaxTq);           
            textBoxBrakeCoeff.Text = Convert.ToString(brakecoeff);
Posts: 4
Joined: Sat Nov 10, 2012 9:22 am

Return to SD Cars

Who is online

Users browsing this forum: No registered users and 2 guests