Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add weight_on_wheels method #73466

Merged
merged 3 commits into from
May 10, 2024

Conversation

natsirt721
Copy link
Contributor

Summary

Bugfixes "Muscle-powered vehicles counting animal weight for traction purposes"

Purpose of change

Fixes #73341

Describe the solution

When calculating traction and rolling resistance, the vehicle code used the entire weight of the vehicle to determine the loading that each wheel had. This did not account for the fact that beasts of burden are supporting their own weight and not contributing to the loading on the wheels of the vehicle they are pulling. This caused the issue seen in the original report - the 250kg wagon's wheels were bearing the weight of 2200 kg of horse, causing extremely low offroad traction and acceleration.

This changes adds a new function weight_on_wheels which returns the mass of the vehicle minus the weight of any harnessed creatures. This function is used in the two places where the mass of the vehicle is used to calculate loading effects on the wheels - traction and rolling resistance.

Describe alternatives you've considered

Making this a cached value that is calculated whenever mass_cache is. I didn't notice any performance issues but I'll admit that I wasn't looking for them.

Testing

Spawned two wagons and upgraded one of them to a four-horse configuration. Examined the rolling resistance and offroad rating of each with and without harnessed animals and observed no meaningful difference. Did some racing both on and off road and with a load:

horse count surface load time to 16 mph
2 road 0 10s
2 road 450 kg 14s
2 dirt 0 10s
2 dirt 450 kg n/a*
4 road 0 13s
4 road 450 kg 19s
4 dirt 0 13s
4 dirt 450 kg 31s
  • the vehicle topped out at 13 mph around 28 seconds

Without a load, both vehicles have an offroad rating of 100%, so they perform the same on dirt and pavement. With the load, this drops to 20%, and the power from the additional horses makes the difference

Additional context

@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) Vehicles Vehicles, parts, mechanics & interactions [C++] Changes (can be) made in C++. Previously named `Code` labels May 3, 2024
src/vehicle.cpp Outdated Show resolved Hide resolved
src/vehicle.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label May 3, 2024
natsirt721 and others added 2 commits May 4, 2024 13:14
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels May 4, 2024
@dseguin dseguin merged commit 1bfc562 into CleverRaven:master May 10, 2024
20 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Four horse cart is slower than a two horse cart
2 participants