Stunts Forum

Stunts - the Game => Stunts Reverse Engineering => Topic started by: Ryoma on January 25, 2022, 08:15:38 AM

Title: How to calculate the graph
Post by: 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).

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 ?
Title: Re: How to calculate the graph
Post by: Daniel3D on January 25, 2022, 09:16:35 AM
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.
Title: Re: How to calculate the graph
Post by: Zapper on January 25, 2022, 07:02:11 PM
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;

Title: Re: How to calculate the graph
Post by: 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.

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)
Title: Re: How to calculate the graph
Post by: Cas on January 26, 2022, 03:21:50 AM
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.
Title: Re: How to calculate the graph
Post by: Ryoma on January 26, 2022, 04:27:59 AM
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.
Title: Re: How to calculate the graph
Post by: Duplode on January 26, 2022, 04:41:56 AM
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 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:
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:
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.
Title: Re: How to calculate the graph
Post by: Ryoma on January 26, 2022, 05:09:17 AM
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.
Title: Re: How to calculate the graph
Post by: Duplode on January 26, 2022, 05:22:37 AM
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.
Title: Re: How to calculate the graph
Post by: Ryoma on January 26, 2022, 07:15:51 AM
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
Title: Re: How to calculate the graph
Post by: Ryoma on January 26, 2022, 12:36:03 PM
Without counting into account the gear ratio change speed
Title: Re: How to calculate the graph
Post by: Ryoma on January 26, 2022, 12:44:18 PM
The first one was for the Testarossa. This for the LM002.
Title: Re: How to calculate the graph
Post by: 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.
Title: Re: How to calculate the graph
Post by: Ryoma on January 26, 2022, 02:39:20 PM
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.
Title: Re: How to calculate the graph
Post by: Daniel3D on January 26, 2022, 04:51:58 PM
QuoteIt can be improve but I very proud of this dyno.
I can imagine. It's very useful.
Title: Re: How to calculate the graph
Post by: Cas on January 26, 2022, 10:41:24 PM
You guys certainly have it a lot clearer than I, ha, ha.

Yes, I can easily find the top of the curve and get the maximum torque and the RPM at which the maximum is hit. Then I'd have to take a careful look at the numbers here and in the wiki to convert this to actual power values. I could also use this to display the Y axis of the graph relative to actual torque or power values instead of internal coordinates. I would like to also allow for every value in the parameter list to be displayable/editable in any of internal/imperial/metric systems. This would aid in the development and calibration of cars made out of real life ones.

I suppose it would be strange to see the power in Watts and the RPMs converted to Hz, even for those of us that use the metric system everyday because cars have their special jargon. Kind of like computer monitors are sized in inches. But still, I think it'd be important to adapt even that because somebody has to make the first move towards universal units, of course, while keeping other units as well.

I will have to retouch some routines... probably rewriting the parameter editing functions.
Title: Re: How to calculate the graph
Post by: Duplode on January 27, 2022, 12:52:17 AM
Too bad I can't properly test it right now (no Excel in this computer). Excellent work, Ryoma!
Title: Re: How to calculate the graph
Post by: KyLiE on January 27, 2022, 05:50:22 AM
Quote from: Cas on January 26, 2022, 10:41:24 PM
I suppose it would be strange to see the power in Watts

Not at all.  In Australia we use the kilowatt (kW) as the measurement of power output from an engine.  However, as a car enthusiast, I've become familiar with horsepower (HP) measurements as well since they are commonly used elsewhere in the world.
Title: Re: How to calculate the graph
Post by: Ryoma on January 27, 2022, 06:05:09 AM
I am familiar with a torque in m.kg not N.m (ratio 9.81) and a speed in Km/h not mph. (Ratio 1.6)

And power is not really representative for me in W (need kW moreover) but in HP (ch in France CV is for fiscal power).
Title: Re: How to calculate the graph
Post by: Ryoma on January 27, 2022, 12:39:12 PM
The original Ferrari GTO had passed the bench :
The weight is correct but the power is far away the real one (320Hp instead of 400).

Another thing, the 5th does not allowed (in normal condition not PG) to reach the maximum speed.
Title: Re: How to calculate the graph
Post by: Ryoma on January 28, 2022, 08:37:59 AM
The countach, it seems but i need to confirm that it's the spec of the LP400 with a 4L V12.

In that case, we can use the dashboard from TD1 or 2.
Title: Re: How to calculate the graph
Post by: Zapper on January 28, 2022, 06:03:09 PM
Ryoma, as a suggestion, can you try some more bench tests on some of my car pack:

http://zak.stunts.hu/dl/zapper-cars.zip

this car pack was created with the goal of getting the real performance figures of original stunts cars.
Title: Re: How to calculate the graph
Post by: Ryoma on January 28, 2022, 06:37:50 PM
Yes good idea.
Title: Re: How to calculate the graph
Post by: Ryoma on January 29, 2022, 06:06:22 PM
Zapper cars 1
Title: Re: How to calculate the graph
Post by: Ryoma on January 29, 2022, 06:07:22 PM
Zapper cars 2
Title: Re: How to calculate the graph
Post by: Ryoma on January 29, 2022, 06:08:19 PM
Zapper cars 3
Title: Re: How to calculate the graph
Post by: Ryoma on January 29, 2022, 06:08:59 PM
Zapper cars last
Title: Re: How to calculate the graph
Post by: Zapper on January 30, 2022, 11:54:55 AM
From the shown results it seems that back in the day (2002), aimming to real 0-60MPH, top speed or using just torque curves (when accessible) was not accurate enough to get the correct performance.
I used CarTest 4.5 as a source of information back then:

(http://forum.stunts.hu/index.php?action=dlattach;topic=3901.0;attach=8967;image)(http://forum.stunts.hu/index.php?action=dlattach;topic=3901.0;attach=8965;image)
(https://archive.org/details/cartest_202106)

Seems now that "Zapper's Car Pack" has room to achive the "tunned for REAL" state :D
Title: Re: How to calculate the graph
Post by: Zapper on January 30, 2022, 12:28:26 PM
I've compared your bench results with CarTest3 for the Lamborghini Countach (Zapper's Car Pack) and I see that the performance specs differ:

MaxTorque: 462 Nm vs 492 Nm
MaxPower: 367 HP vs 391 HP

(http://forum.stunts.hu/index.php?action=dlattach;topic=3901.0;attach=8943;image)
Title: Re: How to calculate the graph
Post by: Ryoma on January 30, 2022, 12:28:54 PM
As Duplode said and as I understand : torque and weight are linked. It's the reason why the countach and the gto are speedy.

Another thing : I used 7 as ratio between torque and game value but this value change from 6.5 to 7.5 for the original cars. The only car which correspond exactly is the carrera 4.

To finish, I used the same value of 7 to have all my cars correspond each other. The only thing I discover thanks Duplode is the use of the idle torque. That explain me why I had to increase weight for the 328 and Delta S4.

492/462*7 = 7.45 the value used by caredit.
Title: Re: How to calculate the graph
Post by: Ryoma on January 30, 2022, 06:01:07 PM
The Skyline from Duplode was calculated with a ratio of 6.5
Title: Re: How to calculate the graph
Post by: Duplode on January 30, 2022, 06:39:44 PM
Quote from: Duplode on January 26, 2022, 04:41:56 AM
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

Quote from: Ryoma on January 30, 2022, 06:01:07 PM
The Skyline from Duplode was calculated with a ratio of 6.5

It seems my guess from the earlier post was right, then  :)

One observation about the Skyline: while I have accidentally left the 6th gear ratio defined in the RES, it only has five gears. That also means the flat track top speed is a little higher than 166 mph.
Title: Re: How to calculate the graph
Post by: Ryoma on February 12, 2022, 09:39:14 AM
Remember the Japanese Gentleman's Agreement, all the car made 280 HP...  Officially.... Because in real...it was much.