Page 1 of 1

### How the torque is calculate between an interval of points Posted: Sat Feb 07, 2015 3:13 pm
How the torque is calculate between an interval of points ?
I try to make an electrical car with a constant torque

In the section engine if i wrote :
Code: Select all
`      <section name="data points">         <section name="1">            <attnum name="rpm" unit="rpm" val="1"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="2">            <attnum name="rpm" unit="rpm" val="5000"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>      </section>`

The engine behavior is not the same than if i wrote :
Code: Select all
`      <section name="data points">         <section name="1">            <attnum name="rpm" unit="rpm" val="1"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="2">            <attnum name="rpm" unit="rpm" val="100"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="3">            <attnum name="rpm" unit="rpm" val="500"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="4">            <attnum name="rpm" unit="rpm" val="1000"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="5">            <attnum name="rpm" unit="rpm" val="1500"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="6">            <attnum name="rpm" unit="rpm" val="2000"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="7">            <attnum name="rpm" unit="rpm" val="2500"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="8">            <attnum name="rpm" unit="rpm" val="3000"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="9">            <attnum name="rpm" unit="rpm" val="3500"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="10">            <attnum name="rpm" unit="rpm" val="4000"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="11">            <attnum name="rpm" unit="rpm" val="4500"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="12">            <attnum name="rpm" unit="rpm" val="5000"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>      </section>`

### Re: How the torque is calculate between an interval of point Posted: Sun Feb 08, 2015 3:29 am
that sounds strange..? even if i don't know the corresponding code, i think all common means of interpolation (linear or xth order) should give the same result in this case..?

### Re: How the torque is calculate between an interval of point Posted: Fri Feb 13, 2015 6:03 am
Hi,

This is exceptionally decent and wonderful post.
I am very happy joined this forum.
I like it exceptionally much....!!!!

Thanks alot...

### Re: How the torque is calculate between an interval of point Posted: Fri Feb 13, 2015 9:39 pm
have a look at engine.cpp:

Code: Select all
`Tq_max = engine->rads * curve->data[i].a + curve->data[i].b;`

thus linear interpolation where a and b are previously eveluated:

Code: Select all
`data->a = (edesc[i+1].tq - edesc[i].tq) / (edesc[i+1].rpm - edesc[i].rpm);data->b = edesc[i].tq - data->a * edesc[i].rpm;`

so a is slope between two points (which should always be 0 in your case), b is corresponding y-intercept (which should always be 300 in your case).

This is the same for simuv4 and simuv2.1, so i still wonder why you get different results..?

### Re: How the torque is calculate between an interval of point Posted: Mon Feb 16, 2015 6:08 pm
Thank you Simon for yout answer.

Me too, I don't know why...
I test with simu v4
In the first example the car is uncontrollable, the engine climbs slowly between 0 to ~1500 rpm and after it takes instantly 5000rpm
Also I test with a third point at 1500rpm :
Code: Select all
`      <section name="data points">         <section name="1">            <attnum name="rpm" unit="rpm" val="1"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="2">            <attnum name="rpm" unit="rpm" val="1500"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>         <section name="3">            <attnum name="rpm" unit="rpm" val="5000"/>            <attnum name="Tq" unit="N.m" val="300"/>         </section>      </section>`
Then the engine climbs slowly between 0 to ~3000 rpm and after it takes instantly 5000rpm

mystery and gumdrop (it's a french expression )