This research proposes an efficient energy management system design for medium-voltage distribution networks from a perspective of convex optimization. The exact nonlinear programming problem that represents the operation of distributed energy resources (DERs), such as batteries and photovoltaic sources, is approximated as an equivalent semi-definite programming (SDP) problem. This SDP approximation is achieved in the complex domain using Hermitian matrices, which are the equivalent of positive semi-definite matrices in the real number domain. Two test feeders, one with 27 nodes and the other with 33 nodes, are modified to match the characteristics of Colombian rural and urban networks. The 27-bus grid is adapted to accommodate the average demand and solar generation conditions of the municipality of Capurganá, while those of the city of Medellín are used for the 33-bus grid. One of the main contributions of this research is that it considers a DER operation with variable power factors, which allows for significant improvements compared to the traditional use of a unitary power factor scheme. Numerical comparisons are conducted using metaheuristic optimizers, including parallel versions of the particle swarm optimizer, the vortex search algorithm, and the continuous version of the genetic algorithm. These comparisons demonstrate the effectiveness of the proposed SDP approximation. All simulations are carried out in the MATLAB software (version 2022b), using the disciplined convex optimizer (CVX) and the SDPT3 and SEDUMI solvers.