Feature Request #532

Fuel Consumption and Fuel Tank

Added by douglasmartins123 over 1 year ago. Updated 5 months ago.

Status:New Start date:11/07/2010
Priority:Normal Due date:
Assignee:tdev % Done:

0%

Category:RoR - General
Target version:0.39

Description

A new option for the game would be the supply of gasoline in cars and trucks.
Since consumption varied according to power the car and the force applied on
the accelerator. There could be setup on each car's tank size and in-game when
you press the letter "F", see the average consumption. It is simple to implement
this feature in the game. I would like to schedule the Rigs of Rods for personal
use or to publish my updates.

History

#1 Updated by bkcokota over 1 year ago

From what I remember from discussions in the forum this feature is not that simple to make and there is quite a bit more maths to it than foot down = more petrol, also, if you are wanting to develop for RoR we'll be more than happy to help with anything you want. If I remember correctly they were working in LUA for the refuelling code.

#2 Updated by memory over 1 year ago

bkcokota wrote:

From what I remember from discussions in the forum this feature is not that simple to make and there is quite a bit more maths to it than foot down = more petrol, also, if you are wanting to develop for RoR we'll be more than happy to help with anything you want. If I remember correctly they were working in LUA for the refuelling code.

Of course! If you foot down at 50 kmh and you are in 5th gear...how much petrol to reach 120 kmh??! :)
I was searching for the fuel code in Torcs some time ago ... it could be a start!

Anyway it would be a good feature!

#3 Updated by douglasmartins123 over 1 year ago

Of course! If you foot down at 50 kmh and you are in 5th gear...how much petrol to reach 120 kmh??! :)
I was searching for the fuel code in Torcs some time ago ... it could be a start!

Anyway it would be a good feature!

It's simple shape. I understand the issue. See the following:
Set-in settings for each car which is the consumption in each liter of engine
speed. (Example 1 liter)
-Formula:
Consumption X RPM X Throttle Pressure

Example to 120km/h:
1 liter X 2500RPM X 50% Accelerator = 1250 liters per second.
It is logical that a car does not spend it, but you understand how? From this also
enables the creation of a device that calculates the consumption L / km.

#4 Updated by 1crash007 over 1 year ago

I found a base to start fuel calculation based on tank size...
Using LUA code would be a possible way as there is already a script for distance driven already.

http://www.cleavebooks.co.uk/scol/ccfuel.htm

and this one also

http://opentoronto.com/calculators/MPG_calculator_calculate_MPG_fuel_efficiency_gas_consumption_fuel_economy.php

#5 Updated by douglasmartins123 over 1 year ago

This is not a good base. A good foundation is what I said:
Consumption X RPM X Throttle Pressure

Example to 120km / h car consumes 1 liter per Rotation:
1 liter X 2500RPM X 50% Accelerator = 1250 liters per second.

Anyone could enter this formula in the game, and the *. truck cars would have the value of consumption of the car, and the ability of the fuel tank. I think it is not difficult.

I really wanted to program the game, or someone to test with the formula proposed, and send me to me to test.

I waiting good answers.

#Translated by Google

#6 Updated by 1crash007 over 1 year ago

I think just having a consumption number isnt enough maybe calculating engine size into the formula...

A base formula like you posted would be good but adding something like this..

Fuel Capacity = Fc
Engine Size (Cylinders) = Cyl
Liter Displacement = Ltr
Rpm Vlaue= Rpm
Mass (resistance) = Ms

So maybe something like:
Fc/(Cyl*Ltr)= Volume
Example = 60 liters Divided ( 6 Cylinders X 1300cc) = 1.30 liters
So
1.3 * Rpm(700) / Tourque(124hp)= 7.33 liters per 100 km
7.33 liters * 6 Cyls / mass 2300 kg = 0.019 liters used at idle

Does this make any sense to you?

#7 Updated by douglasmartins123 over 1 year ago

Perfect!

But while the proportion of pressure applied on the accelerator? When the accelerator is pressed to the maximum, is different when it's free.

Only one configuration of torque coming in cars Rigs of Rods, enough. Think there a possibility that already include this feature in the game.

#Translated from PT-BR to EN-US from Google Translator

#8 Updated by 1crash007 over 1 year ago

douglasmartins123 wrote:

Perfect!

But while the proportion of pressure applied on the accelerator? When the accelerator is pressed to the maximum, is different when it's free.

Only one configuration of torque coming in cars Rigs of Rods, enough. Think there a possibility that already include this feature in the game.

#Translated from PT-BR to EN-US from Google Translator

Let me take some more time it think the 0.019 * 50% throttle or 0.5 = 0.0095 liters a second * 100 kilometers = 0.95 liters / 6000 seconds or one hour = 1.58 liters consumed

Now at say 1200 rpm

1.3 * Rpm(1200) / 124 hp = 12.58 liters
12.58 * 6 Cyls / mass 2300 kg = 0.032
Throttle at 80% for theory.
0.032 * 80% or 0.8 = 0.0256 liters a second * 100 kms = 2.56 liters / 6000 seconds or one hour = 4.27 liters consumed pretty gas hog if i ever seen one.

Let me take some more time to calculate something better yet. some variables dont look right in my opinion.

#9 Updated by memory over 1 year ago

1crash007 wrote:

douglasmartins123 wrote:

Perfect!

But while the proportion of pressure applied on the accelerator? When the accelerator is pressed to the maximum, is different when it's free.

Only one configuration of torque coming in cars Rigs of Rods, enough. Think there a possibility that already include this feature in the game.

#Translated from PT-BR to EN-US from Google Translator

Let me take some more time it think the 0.019 * 50% throttle or 0.5 = 0.0095 liters a second * 100 kilometers = 0.95 liters / 6000 seconds or one hour = 1.58 liters consumed

Now at say 1200 rpm

1.3 * Rpm(1200) / 124 hp = 12.58 liters
12.58 * 6 Cyls / mass 2300 kg = 0.032
Throttle at 80% for theory.
0.032 * 80% or 0.8 = 0.0256 liters a second * 100 kms = 2.56 liters / 6000 seconds or one hour = 4.27 liters consumed pretty gas hog if i ever seen one.

Let me take some more time to calculate something better yet. some variables dont look right in my opinion.

Well veichle mass while being in idle isn't that correct...

#10 Updated by douglasmartins123 over 1 year ago

Idle can be assumed that the accelerator is 1-5%.
If the vehicle is heavier, require more throttle and thus greater consumption. Just my formula boat there, the rest, the physical help. This game need of mechanics who understand deeply, and that person is me. I am also a programmer, and I may as well plan for Rigs of Rods. I just need guidance.

#11 Updated by 1crash007 over 1 year ago

douglasmartins123 wrote:

Idle can be assumed that the accelerator is 1-5%.
If the vehicle is heavier, require more throttle and thus greater consumption. Just my formula boat there, the rest, the physical help. This game need of mechanics who understand deeply, and that person is me. I am also a programmer, and I may as well plan for Rigs of Rods. I just need guidance.

Ok i may have found another solution that determines fuel consumption and rpm but im still figuring out some other small caclulations.
I eliminated mass as part of the equation:

2.0 Liter Engine 122 Cu.In (1999cc) 4 Cyl. 73hp 4000rpm
10% throttle Consumes 0.122
488 Rpm
30% throttle Consumes 0.433 1732 Rpm
50% throttle Consumes 0.649
2596 Rpm
70% throttle Consumes 0.854 3416 Rpm
90% throttle Consumes 1.098
4392 Rpm

The consumption numbers still dont add up right there should be rounded to 10,000th of a liter like 0.122 should be 0.0122
that is an equation that im missing.

#12 Updated by douglasmartins123 over 1 year ago

Ok That is, the basis is this. Perfect. Just missing settings. But it would be difficult to include this formula in the game? Has a term for this? Keep me informed. Thanks for the support, and hope we'll get there.

Translated by Google

#13 Updated by memory over 1 year ago

douglasmartins123 wrote:

Ok That is, the basis is this. Perfect. Just missing settings. But it would be difficult to include this formula in the game? Has a term for this? Keep me informed. Thanks for the support, and hope we'll get there.

Translated by Google

Well just adding a formula in the game isn't so difficult...take a look in the engine.cpp!

#14 Updated by douglasmartins123 over 1 year ago

engine.cpp?? What could this be?

Then, the process is already underway? One way to fuel the game is already on its way? Thanks for everything, and if you can send me the game, or some other method with the formula already in the game and already in service, thank you!

#15 Updated by memory over 1 year ago

douglasmartins123 wrote:

engine.cpp?? What could this be?

Then, the process is already underway? One way to fuel the game is already on its way? Thanks for everything, and if you can send me the game, or some other method with the formula already in the game and already in service, thank you!

engine.cpp is the code of the engine simulation part of the game! It's intended only for developers....or just people who want to experiment :)

#16 Updated by douglasmartins123 over 1 year ago

I know programming, but there is some tutorial for me to test my changes in the game? I saw some *. cpp files on the Internet for Rigs of Rods, but as I test my game? Has, I test this function of the fuel in the game?

Easier, I even wanted to change the game. Can you help me, have some email or instant message (MSN)?

Thanks.

#Google Translate

#17 Updated by 1crash007 over 1 year ago

douglasmartins123 wrote:

I know programming, but there is some tutorial for me to test my changes in the game? I saw some *. cpp files on the Internet for Rigs of Rods, but as I test my game? Has, I test this function of the fuel in the game?

Easier, I even wanted to change the game. Can you help me, have some email or instant message (MSN)?

Thanks.

#Google Translate

goto the wiki where the developers section is to learn to compile.

#18 Updated by tdev 12 months ago

  • Target version set to 0.39

#19 Updated by douglasmartins123 12 months ago

Basically, the formula would be:

Gasoline consumption * (Torque * RPM * Accelerattor Pressure (%))

Recalling that the torque varies with the rotation(TorqueModels). And can not forget to include an option like "Tank Capacity" and within the game would have a meter consumption in KM/Liter or L/100km. In type KM/L would be the last 5km (or other similar distance) divided by liters consumed.

If I could even test this function before releasing to the public, would be great, and hopefully it will be released in coming updates!

(Google Translate)

#20 Updated by douglasmartins123 7 months ago

?

#21 Updated by douglasmartins123 7 months ago

Formula:
(Torque * RPM * Accelerattor Pressure) / 450.000 = Liters/Hour

example:
(Torque * RPM * Accelerattor Pressure) / 450.000 = Liters/Hour
(1800 * 3000 * 70%) / 450.000 = Liters/Hour
(3,780,000) / 450.000) = Liters/Hour
(3,780,000) / 450.000) = 8.4 L

100 km/h = 8.4 Liters/Hour

For Consumption, you have to know how much the car around in a space of time.
example:
One Hour -> 100km
One Hour -> 8.4L

Consumption, "8.4L/100km" or 11.9 km/l

Simple!

Also available in: Atom PDF