A photovoltaic energy system includes a photovoltaic field configured to convert solar energy into electrical energy, a power inverter configured to control an electric power output of the photovoltaic field, and a controller. The controller can determine optimal power setpoints for the power inverter by optimizing a value function that includes a penalty cost for failing to comply with a ramp rate limit and photovoltaic revenue.