Hello folks,
Can anyone tell the formula that Factorio uses to calculate the decelleration (meters / tick) of a car-prototype?
How does the Braking_Power, Friction and Weight apply here?
Are there any other variables I have to take in account, like surface wind speed and direction, terrain friction?
Eventually I want to calculate the time and distance it takes to come to stop (speed = 0) from any given speed.
Thanks in advance.
Kind regards,
Drakomir
Calculating the braking distance/time for car-prototype.
Re: Calculating the braking distance/time for car-prototype.
I think I found the formula I was looking for.
Given the following parameters:
A car-prototype with the following constants of interest:
In Factorio 15.34 the following values apply:
The surface' wind-speed and wind-direction does not seem to affect the car-entity.
Kinect energy equation of the car-entity: E = 0.5 * mass * velocity * velocity.
Braking is expressed in Wattage, so by dividing this value by 60 (ticks / second), you have the amount of Joule you can subtract from the car-energy each tick (while braking).
Acceleration works in the opposite way as braking, by adding the consumption / 60 towards the energy level of the car each tick (while your car.energy (burner) > 0).
Note: car-enery = kinect momentum, car.energy is the energy provided by the burner.
The energy-level is a virtual value that defines the behavior of the car-entity, you can only derive it with your mod. But with it you can calculate the exact (rounding error's aside) the braking-distance or braking-time given a certain starting velocity.
The friction is the energy multiplier, if the car is coasting (not accellerating or braking) the new/next-tick energy-level will be E-next = E-current * F-current. F-current depends on the surface the car is coasting on.
I hope this helps anyone who's looking for the same answers.
Given the following parameters:
A car-prototype with the following constants of interest:
- weight (mass)
- consumption
- braking_power
- friction (internal rolling resistance, applied regardless of riding_state.acceleration)
In Factorio 15.34 the following values apply:
- Concrete=0.8
- Stone=1.1
- Dirt=1.4
- Grass=1.6
- Sand=1.8
The surface' wind-speed and wind-direction does not seem to affect the car-entity.
Kinect energy equation of the car-entity: E = 0.5 * mass * velocity * velocity.
Braking is expressed in Wattage, so by dividing this value by 60 (ticks / second), you have the amount of Joule you can subtract from the car-energy each tick (while braking).
Acceleration works in the opposite way as braking, by adding the consumption / 60 towards the energy level of the car each tick (while your car.energy (burner) > 0).
Note: car-enery = kinect momentum, car.energy is the energy provided by the burner.
The energy-level is a virtual value that defines the behavior of the car-entity, you can only derive it with your mod. But with it you can calculate the exact (rounding error's aside) the braking-distance or braking-time given a certain starting velocity.
The friction is the energy multiplier, if the car is coasting (not accellerating or braking) the new/next-tick energy-level will be E-next = E-current * F-current. F-current depends on the surface the car is coasting on.
Code: Select all
E = kinectic energy
F = friction
V = velocity
V-current = (2 * E-current / mass) ^ 0.5
V-next = (2 * E-current * F-current / mass) ^ 0.5
Re: Calculating the braking distance/time for car-prototype.
I've made some mode to get positions, speed and acceleration of the car.
The example of output (with a little bit of mathematics), x-axis: ticks; y-axis: speed, tiles/sec You must make a new game for testing, not playable.
The example of output (with a little bit of mathematics), x-axis: ticks; y-axis: speed, tiles/sec You must make a new game for testing, not playable.
Re: Calculating the braking distance/time for car-prototype.
Thanks Darkfrei, the graph's seem to correspond with my own findings.