This paper proposes an Optimal Power Flow (OPF) algorithm by Direct Load Control (DLC) programs to optimize the operational cost of smart grids considering various scenarios based on different constraints. The cost function includes active power production cost of available power sources and a novel flexible load curtailment cost associated with DLC programs. The load curtailment cost is based on a virtual generator for each load (which participates in DLC program). To implement the load curtailment in the objective function, we consider incentive payments for participants and a load shedding priority list in some events. The proposed OPF methodology is applied to IEEE 14, 30-bus, and 13-node industrial power systems as three examples of the smart grids, respectively. The numerical results of the proposed algorithm are compared with the results obtained by applying MATPOWER to the nominal case by using the DLC programs. It is shown that the suggested approach converges to a better quality solution in an acceptable computation time.