The operation of a stand‐alone photovoltaic (PV) system ultimately aims for the optimization of its energy storage. We present a mathematical model for cost‐effective control of a stand‐alone system based on a PV panel equipped with an angle adjustment device. The model is based on viscosity solutions to partial differential equations, which serve as a new and mathematically rigorous tool for modeling, analyzing, and controlling PV systems. We formulate a stochastic optimal switching problem of the panel angle, which is here a binary variable to be dynamically controlled under stochastic weather condition. The stochasticity comes from cloud cover dynamics, which is modeled with a nonlinear stochastic differential equation. In finding the optimal control policy of the panel angle, switching the angle is subject to impulsive cost and reduces to solving a system of Hamilton‐Jacobi‐Bellman quasi‐variational inequalities (HJBQVIs). We show that the stochastic differential equation is well posed and that the HJBQVIs admit a unique viscosity solution. In addition, a finite‐difference scheme is proposed for the numerical discretization of HJBQVIs. A demonstrative computational example of the HJBQVIs, with emphasis on a stand‐alone experimental system, is finally presented with practical implications for its cost‐effective operation.