suboptimumg.compsim.competition#

class suboptimumg.compsim.competition.Competition(mycar, accel, skidpad, autoX, endurance, scoring)[source]#

Bases: object

Runs and scores a full FSAE competition for a given car and set of tracks.

Parameters:
accel_event(extract_internal_data=False)[source]#

Simulates the acceleration event in the competition.

Parameters:

extract_internal_data (bool, optional) – Whether to extract internal data during the simulation, by default False.

Returns:

The results of the acceleration event simulation.

Return type:

EventResults

autoX_event(extract_internal_data=False)[source]#

Simulates the autocross event in the competition.

Parameters:

extract_internal_data (bool, optional) – Whether to extract internal data during the simulation, by default False.

Returns:

The results of the autocross event simulation.

Return type:

EventResults

Notes

The initial velocity is set to 1.0 m/s rather than 0, since the timer uses a transponder at the back of the car, giving roughly one wheelbase of rollout before timing starts.

efficiency_endurance_event(extract_internal_data=False)[source]#

Simulates the endurance event in the competition, and also calculates efficiency points.

Parameters:

extract_internal_data (bool, optional) – Whether to extract internal data during the simulation, by default False.

Returns:

Endurance event results, efficiency points, and consumed energy in kWh.

Return type:

tuple[EventResults, float, float]

endurance_event(extract_internal_data=False, use_coast=True)[source]#

Simulates the endurance event in the competition.

Parameters:
  • extract_internal_data (bool, optional) – Whether to extract internal data during the simulation, by default False.

  • use_coast (bool, optional) – Whether to allow the car to coast and regen instead of braking, by default True.

Returns:

The results of the endurance event simulation.

Return type:

EventResults

Notes

The initial velocity is set to 1.0 m/s for the same rollout reason described in autoX_event.

run(extract_internal_data=False)[source]#

Runs all competition events and returns their results.

Parameters:

extract_internal_data (bool, optional) – Whether to extract internal data during the simulation, by default False.

Returns:

Results from all competition events including efficiency points.

Return type:

CompetitionResults

skidpad_event(extract_internal_data=False)[source]#

Simulates the skidpad event in the competition.

Parameters:

extract_internal_data (bool, optional) – Whether to extract internal data during the simulation, by default False.

Returns:

The results of the skidpad event simulation.

Return type:

EventResults

to_data()[source]#

Serialize the Competition to a CompetitionData model for Pydantic serialization.

Return type:

CompetitionData