On a new q-ary combinatorial analog of the binary Grey-Rankin bound and codes meeting this bound

For any integer q we present a new bound which is a q-ary combinatorial analog of the binary Grey-Rankin bound. For any prime power q we present two infinite classes of q-ary codes which meet this bound with integral equality. Moreover, we show how codes meeting this bound with equality are connected to several important classical combinatorial configurations, such as difference matrices and generalized Hadamard matrices.