juanmanzanero / fastest-lap

Fastest-lap is a vehicle dynamics simulator. It can be used to understand vehicle dynamics, to learn about driving techniques, to design car prototypes, or just for fun!
MIT License
575 stars 43 forks source link

Energy limits #12

Closed dfamonteiro closed 2 years ago

dfamonteiro commented 2 years ago

Allowing the user to set a maximum energy limit for a lap (i.e. fuel limit per lap) could make this simulation tool very useful for racing series such as Indycar and Formula E.

Setting energy limits and power limits to each individual tire could also produce lap simulations that could tell us more about how drivers change their driving style in order to make the tires last.

Thank you for building this simulation tool!

juanmanzanero commented 2 years ago

Hello! Noted. This is a super interesting addition. Thanks!

juanmanzanero commented 2 years ago

Hello @dfamonteiro !

Energy limits are coming along. The code is ready and two tests (one for engine limit, and other for tire limits) were added to the continuous integration, but it is not still included into the python world. I just found it slows down things (a laptime is roughly 3 times slower). I will investigate this in the future, but for the time being I will live with it. (It does not affect the performance without energy limits.)

Screenshot 2022-06-08 at 20 33 15

juanmanzanero commented 2 years ago

Done! Find an example here

You can use:

  1. engine-energy
  2. tire-fl-energy
  3. tire-fr-energy
  4. tire-rl-energy
  5. tire-rr-energy

I first run a lap without limits, to see the maximum energy the car can perform. Then run a second lap applying the desired limits. For engine-energy simulations, the parameter vehicle/rear-axle/smooth_throttle_coeff must be 1.0e-2, otherwise the simulation will not converge. This does not destroy the accuracy anyhow, since the default parameter 1.0e-5 was super low already (see this paper)

Screenshot 2022-06-09 at 22 03 27

.