<s> from . data_calc import DataCalc <EOL> class TorqueCalc ( DataCalc ) : <EOL> def __init__ ( self ) : <EOL> self . initialize_data ( ) <EOL> def initialize_data ( self ) : <EOL> self . data = <NUM_LIT:0.0> <EOL> self . engine_to_torque = <NUM_LIT> / <NUM_LIT> <EOL> self . name = '<STR_LIT>' <EOL> self . gear_numbers = { '<STR_LIT>' : <NUM_LIT:0> , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT>' : <NUM_LIT:3> , <EOL> '<STR_LIT>' : <NUM_LIT:4> , '<STR_LIT>' : <NUM_LIT:5> , '<STR_LIT>' : <NUM_LIT:6> } <EOL> def iterate ( self , snapshot ) : <EOL> accelerator = snapshot [ '<STR_LIT>' ] <EOL> engine_speed = snapshot [ '<STR_LIT>' ] <EOL> engine_running = snapshot [ '<STR_LIT>' ] <EOL> gear_number = self . gear_numbers [ snapshot [ '<STR_LIT>' ] ] <EOL> gear_number = gear_number - <NUM_LIT:1> <EOL> if gear_number < <NUM_LIT:1> : <EOL> gear_number = <NUM_LIT:1> <EOL> gear_ratio = <NUM_LIT:1> - ( gear_number * <NUM_LIT> ) <EOL> drag = engine_speed * self . engine_to_torque <EOL> power = accelerator * <NUM_LIT:15> * gear_ratio <EOL> if engine_running : <EOL> self . data = power - drag <EOL> else : <EOL> self . data = - drag </s>
