This work addressed the problem of integration and operation of Ion-lithium batteries of different technical characteristics in grid-connected networks (GCN) for reducing the energy losses and CO2 emissions. To formulate the mathematical problem, nonlinear mathematical modeling was used, taking into account the previously mentioned objective functions and all the constraints that represent the operation of the grid in a scenario of variable photovoltaic generation and power demand. This paper proposed a master–slave methodology, which uses a parallel discrete version of the vortex search algorithm (PDVSA) for solving the problem of location and selection of the kind of battery in the GNC. The slave stage is entrusted to find the operation scheme of the batteries proposed for the master stage. This task is carried out by a particle swarm optimization algorithm (PSO) that defines the power to be supplied or stored for each battery. Using a matrix hourly power flow for calculating the effect in the objective function and constraints that represent the problem. As a test scenario, it was used a GCN of 33 buses and 32 lines that considered the photovoltaic generation and demand of Medellín-Colombia, and all technical and environmental indexes of the local grid operator. Six comparison methodologies were used from the literature and developed in this work to evaluate the effectiveness of the proposed methodology. Being all programming in MATLAB software, executing each one 1000 times with the aim to evaluate the performance in terms of solution, repeatability, and processing times. The results obtained demonstrating that the proposed PDVSA/PSO methodology achieved the best results in terms of solution, with reductions of 154.9094 kWh (6.23%) in energy losses and reductions of 0.0252 tons of CO2 (0.2548%) in pollutant gas emissions compared to the base case. Regarding repeatability, the PDVSA/PSO exhibits standard deviation values of 0.1383% for energy losses and 0.0034% for CO2 emissions.