update input and out put of calculateTrainPostion