Added calculate_ped_switch_error

and switch error function