Simulation and algorithm are connected with a block in the MATLAB which is called s-function.The simulated power network is shown in Figure (5). Several cases of fault on the length transmission line by different fault locations and fault resistances is taken. the faults are detected and classified in the half period by using the procedure as shown in figure (3) .