News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

How to calculate the graph

Started by Ryoma, January 25, 2022, 08:15:38 AM

Previous topic - Next topic

Ryoma

Now I know how to read value with Excel, I want to progress by making my own Carwork by including real value (Torque curve in N.m, weight, ratio gear, and so on).

Actually my excel do calculation and I put the result manually in carwork. My version will be only an engine bench without the shape and Dashboard. I think I will call it Stunts dyno.

My question is how to calculate the graph attached.

I know that this graph is stange when the gear ratio is not good. But how to make a relation beetween acceleration, car weight, Cx, Torque, RPM et Gear ratio ?

Daniel3D

I think it's simplified.
Torque growing (exponentially?) from lowest gear ratio to highest. Combined with RPM and a weight modifier.

Something like that.

The formula is in the code. CAS can probably read the exact way they used for stunts.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

Zapper

Quote from: Ryoma on January 25, 2022, 08:15:38 AM
Now I know how to read value with Excel, I want to progress by making my own Carwork by including real value (Torque curve in N.m, weight, ratio gear, and so on).

(...)

For getting the max power and torque I think you can use the function used in CarEdit3:

pascal source:
PROCEDURE GetResMaxPower(
    var maxNm: Word;
    var maxNmAt: Word;
    var maxHP: Word;
    var maxHPAt: Word);
VAR
    curNm: Word;
    curHP: Word;
    tmp:   Double;
    i:     Integer;
    rpm:   Integer;
BEGIN
    maxNm := 0;
    maxHP := 0;
    FOR i := 0 TO 102 DO
    BEGIN
        rpm := 128*i;
        curNm := Round(7.457 * carData.raw[$61+i]);
        IF (curNm > maxNm) THEN
        BEGIN
            maxNm := curNm;
            maxNmAt := rpm;
        END;
        { (2pi/60) = 0.104719755, 1 PS = 735.49875 W }
        tmp := (0.104719755/735.49875) * curNm * rpm;
        curHP := Round(tmp);
        IF (curHP > maxHP) THEN
        BEGIN
            maxHP := curHP;
            maxHPAt := rpm;
        END
    END;
END;


Ryoma

Ah you used a value of 7.457...I used a value of 7, this is the explanation of the difference between me and caredit. My cars are 7% powerfull than real.

In fact, I'm looking for a formula to find the time between 2 value of RPM according to speed, weight, Cx and gear ratio. It's in ordre to estimate the graph (0-60mph for example)

Cas

Uhm... if I could find the part of the code that draws that, then, yes, maybe I can get the exact original formula. The problem is, I know too little about car specs and how they are calculated in real life, which makes it hard for me to properly adapt Stunts parameters and make CarWorks fully comfortable for experienced car makers.
Earth is my country. Science is my religion.

Ryoma

If I look here http://wiki.stunts.hu/index.php?title=Car_model_physics#Torque_and_mass 1tsu=4lbf*ft by conversion https://convertlive.com/fr/u/convert/pieds-livre-force/a/m%C3%A8tres-de-newton#4 = 5.4233 N.m.

I don't remember where I found this value of 7 close to the value of 7.457 of Zapper.

@cas yes the code will be helpfull maybe the formula on the wiki can give an answer.

Duplode

#6
Quote from: Ryoma on January 25, 2022, 08:37:24 PM
In fact, I'm looking for a formula to find the time between 2 value of RPM according to speed, weight, Cx and gear ratio. It's in ordre to estimate the graph (0-60mph for example)

The formulas you are looking for are:

  • Car speed to engine speed:
    engine_speed = gear_ratio * car_speed / 256
  • Car speed change per time step (0.05 s):
    speed_change = (gear_ratio * torque - aero_drag_coeff * car_speed ^ 2 / 2) / (84480 * mass)
car_speed is in mph, engine_speed is in rpm, and the other values should be taken directly from the RES file.

Some (annoying) details you might want to look into, for extra accuracy:

  • Gear changes are not instantaneous: the positive parcel in the speed change formula goes to zero during the gear change, which typically takes between 0.1 s and 0.5 s (the exact values depend on the RES file gearbox coordinates). That might matter quite a bit in 0-60 mph simulations.
  • The idle rpm torque is used instead of the actual torque curve values for low engine speeds, that is, below 2560 rpm at first gear and up to the idle rpm parameter in higher gears.
Quote from: Ryoma on January 25, 2022, 08:37:24 PM
Ah you used a value of 7.457...I used a value of 7, this is the explanation of the difference between me and caredit. My cars are 7% powerfull than real.

Ultimately, there is no single right answer when it comes to that conversion factor. The two main points to consider are:

  • The game never uses the torque independently from the mass. That means we can only accurately find out their ratio, and one of the individual conversion factors must be chosen arbitrarily.
  • Drivetrain losses (that is, the difference between "raw" engine torque and "effective" torque delivered to the wheels) are not modelled by the game. They are usually said to be around 15% or 20%. That being so, if you have a reference torque curve obtained with an engine dynamometer (as tends to be the case) rather than a chassis one you have to reduce the values by such a factor.
For the torque curve of the Skyline, I used a conversion factor for the effective torque of 4 lbf.ft, a round figure in imperial units which gives out plausible mass values for the original cars if you try to calculate them using the torque-mass ratio. To be able to compare values with those of engine dyno torque curves, we need to guess and add back the drivetrain losses. I don't remember exactly which correction I applied for that, so let's pretend it was a 16.67% (1/6) change. Applying the correction and converting to N.m, we end up with 4*1.356/(5/6)= 6.508 N.m, which is reasonably close to your estimates.

Ryoma

Thanks Duplode for these data.

Another thing funny with this graph : when you made a mistake with the RPM downshift, the graph become flat. So the calculation take into account the RPM upshift (logical) but the the other one.

Duplode

Quote from: Ryoma on January 26, 2022, 05:09:17 AM
Another thing funny with this graph : when you made a mistake with the RPM downshift, the graph become flat. So the calculation take into account the RPM upshift (logical) but the the other one.

Yup, the calculations for the graph account for both upshifts and downshifts depending on the auto gears parameters. I haven't looked closely at how the graph is generated, but it seems likely that it directly runs the same car physics functions used for driving.

Ryoma

Quote from: Duplode on January 26, 2022, 04:41:56 AM
The idle rpm torque is used instead of the actual torque curve values for low engine speeds, that is, below 2560 rpm at first gear and up to the idle rpm parameter in higher gears.

I understand why sometimes I increased the weigth but the 0-60 MPH doesn't change enough

Ryoma

Without counting into account the gear ratio change speed

Ryoma

The first one was for the Testarossa. This for the LM002.

Daniel3D

#12
Quote from: Ryoma on January 26, 2022, 12:36:03 PM
Without counting into account the gear ratio change speed
That is a very accurate copy.
Considering that the 20 mark is in the middle above the '0' of 20 and the 40 is the far right.
Then both cross the 25 line at about the same speed. Maybe the original is a bit faster.

The lm002 looks very good as well. Horizontal it looks spot on again. But it seems to top 10mph slower on the vertical.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)

Ryoma

#13
Quote from: Daniel3D on January 26, 2022, 12:46:07 PM
Quote from: Ryoma on January 26, 2022, 12:36:03 PM
Without counting into account the gear ratio change speed
That is a very accurate copy.
Considering that the 20 mark is in the middle above the '0' of 20 and the 40 is the far right.
Then both cross the 25 line at about the same speed. Maybe the original is a bit faster.

The lm002 looks very good as well. Horizontal it looks spot on again. But it seems to top 10mph slower on the vertical.

Maybe a difference caus eby the RPM max and the RPM upshift...


It can be improve but I very proud of this dyno.

Enjoy the XLS file don't forget to activate the macro.

Daniel3D

QuoteIt can be improve but I very proud of this dyno.
I can imagine. It's very useful.
Edison once said,
"I have not failed 10,000 times,
I've successfully found 10,000 ways that will not work."
---------
Currently running over 20 separate instances of Stunts
---------
Check out the STUNTS resources on my Mega (globe icon)