This document presents a tutorial regarding the use of PV-STATCOMs for dynamic active and reactive power compensation in AC distribution networks. The main idea is to guide the reader from the classical power flow formulation for AC distribution networks in the complex domain to a multi-period power flow problem using the optimization tools available in the Julia programming software. The use of PV-STATCOMs as dynamic active and reactive power compensation tools allows considering different power factors, i.e., they can work as a PV generation plant with a unitary power factor, as a purely reactive power compensator (capacitive or inductive), or as a dynamic active and reactive power compensator with a variable power factor. The Julia software was selected as a programming environment due to its excellent performance in terms of its programming interface and the use of specialized solvers for nonlinear programming problems in the complex domain, which helps introduce some concepts for the efficient operation of distribution networks while focusing on the mathematical model instead of on the solution technique. Numerical results confirm that the proposed approach, which uses the Ipopt solver, yields excellent numerical solutions in comparison with optimization methodologies recently reported in the scientific literature. A version of the IEEE 33-bus grid adapted for multi-period optimal power flow studies was employed as a test feeder. All numerical results were obtained using Julia, with the help of the JuMP optimization environment and the Ipopt solver.