@sh.add_function(dsp, outputs=['r_wheels'])
def calculate_r_wheels(tyre_dimensions):
"""
Calculates the radius of the wheels [m] from the tyre dimensions.
:param tyre_dimensions:
Tyre dimensions.
.. note:: The fields are : use, nominal_section_width, aspect_ratio,
carcass, diameter, load_index, speed_rating, and additional_marks.
:type tyre_dimensions: dict
:return:
Radius of the wheels [m].
:rtype: float
"""
if 'diameter' in tyre_dimensions:
if tyre_dimensions['code'] == 'pax':
return tyre_dimensions['diameter'] / 2000 # Diameter is in mm.
return tyre_dimensions['diameter'] * 0.0254 # Diameter is in inches.
a = tyre_dimensions['aspect_ratio'] / 100 # Aspect ratio is Height/Width.
w = tyre_dimensions['nominal_section_width']
if tyre_dimensions.get('code', 'iso') == 'iso':
w /= 1000 # Width is in mm.
else:
w *= 0.0254 # Width is in inches.
dr = tyre_dimensions['rim_diameter'] * 0.0254 # Rim is in inches.
return a * w + dr / 2