CONTROL ALGORITHM MODELING GUIDELINES USING MATLAB Simulink, and Stateflow v4.01