Derivation of a generalized PSO model and convergence analysis