DCOPFJ (Java): A Free OpenSource Solver for
Bid/OfferBased DC Optimal Power Flow Problems

Software Release Disclaimer:
 All software provided below is unsupported and provided asis, without
warranty of any kind.
Table of Contents:
As elaborated in Sun and Tesfatsion (2007a) and Sun and Tesfatsion (2007b),
the DCOPFJ package is a free opensource Java solver for bid/offerbased DC optimal power flow (DCOPF) problems suitable for research, teaching, and training applications. The DCOPFJ package consists of two linked parts: an internal solver QuadProgJ for strictly convex quadratic programming problems, and an outer shell that automates input data preprocessing
and output data display.
QuadProgJ:
QuadProgJ is a standalone opensource Java solver for strictly convex quadratic programming (SCQP) problems. QuadProgJ implements the wellknown dual activeset SCQP algorithm developed by Goldfarb and Idnani (1983).
As reported in detail in Sun and Tesfatsion (2007a),
QuadProgJ has been successfully tested on small to mediumsized SCQP problems. In particular, QuadProgJ matched or exceeded the accuracy of the proprietary Clanguage QP solver BPMPD when tested on a public repository of SCQP problems with up to 1500 decision variables plus constraints. In use since 1998, BPMPD is highly recommended for power system applications in Appendix A of the MATPOWER User's Manual (2006). In particular, the following statement appears: "Of all of the packages tested, the bpmpd solver has been the only one which worked reliably for us. It has proven to be very robust and has exceptional performance."
Augmented DC Optimal Power Flow (OPF) Formulation:
Standard DCOPF problems with fixed realpower demands (loads) can be equivalently represented in the numerically desirable form of an SCQP problem if the nodal balance constraints are used to eliminate voltage angles by substitution. However, this elimination prevents direct generation of solution values for locational marginal prices (LMPs) since, by definition, the LMP for any node k is the solution value for the Lagrangian multiplier (shadow price) for the kth nodal balance constraint.
For this reason, Sun and Tesfatsion (2007a) augment the standard DCOPF objective function with a softpenalty constraint on the sum of squared voltage angle differences. This augmentation is
extended in Sun and Tesfatsion (2007c) to handle real power demand bids consisting of both fixed and pricesensitive parts.
The resulting augmented DCOPF problem formulation provides three principal benefits based on both physical and mathematical considerations, as follows:
 The augmented problem now has a numerically desirable SCQP form permitting the direct generation of solution values for LMPs and voltage angles as well as for realpower generation levels, realpower branch flows, branch flow shadow prices, and realpower pricesensitive demands (if present).
 The validity of the DCOPF problem as an approximation for the underlying ACOPF problem relies on an assumption of small voltage angle differences, and the augmented DCOPF problem permits this assumption to be subjected to systematic sensitivity tests through variations in the softpenalty weight parameter.
 Solution differences between the nonaugmented and augmented forms of the DCOPF problem can be reduced to arbitrarily small levels by selecting an appropriately small value for the softpenalty weight parameter.
Solution of Augmented DCOPF Problems via DCOPFJ:
As explained with care in Sun and Tesfatsion (2007a), augmented DCOPF problems can be solved by means of the DCOPFJ package, a standalone Java DCOPF solver consisting of QuadProgJ wrapped inside a dataprocessing shell.
The dataprocessing shell sequentially carries out the following four actions: (1) conversion of all input data from SI (International System of Units) to normalized pu (Per Unit) form; (2) formation of all needed matrices and vectors for expressing the augmented DCOPF problem in matrix SCQP form; (3) invocation of QuadProgJ to determine a solution for the resulting matrix SCQP problem; and (4) conversion of all solution output data from pu to SI form. These four actions are
illustrated in detail for a 5node test case taken from power systems texts and ISONE/PJM training manuals.
Using DCOPFJ as a StandAlone DCOPF Solver:
Test cases are included as text files in the "DATA" directory of the DCOPFJ package. The user can specify which of these test case files to run by changing an integervalued flag in the main file DCOPFJ.java for the DCOPFJ package. The main file DCOPFJ.java can be found in the source code directory "src" of the DCOPFJ package. DCOPFJ automatically looks in the DATA directory for cases to be run.
Users can also use these test case files as templates for creating their own DCOPF problems. To create a new DCOPF problem, the user should copy a test case file into a new text file (e.g. MyCase.txt) in the DATA directory. Within MyCase.txt, the user should then substitute their own DCOPF input data in place of the test case input data in the designated places using the designated formatting. The user should then add the new case file name MyCase.txt to the list of case file names in DCOPFJ.java (the list where the test case file names appear). Finally, right below the list of case file names in DCOPFJ.java the user should set the integervalued flag accordingly (e.g., first case in list = 0, second case in list = 1, and so on).
The DCOPFJ package is already in the correct directory form of a standard Java package for use in Java Integrated Development Environments (IDEs) such as NetBeans and JBuilder. After setting up DCOPFJ as a standard Java package, with DCOPFJ.java designated as the main class, the DCOPFJ package can be compiled and run. The output appears in formatted text in the IDE output screen. The user can change the content and form of this output by modifying the output statements in DCOPFJ.java.
Incorporation of DCOPFJ Into Other Packages:
DCOPFJ can be incorporated as a DCOPF solver within other Java applications under the terms of the GNU General Public License
(see below).
For example, as detailed in Sun and Tesfatsion (2007d),
Sun and Tesfatsion (2007e), and
Li, Sun, and Tesfatsion (2008),
DCOPFJ has been incorporated into the
AMES Wholesale Power Market Test Bed,
an opensource Javaimplemented model of a restructured wholesale power market with strategicallylearning traders operating over an AC transmission grid subject to congestion effects.
Software Downloads and Supporting Materials
Version releases to date for the DCOPFJ package are as follows:
DCOPFJVersion 1.1 (Sun and Tesfatsion):
Software Download (V1.1)

Junjie Sun and Leigh Tesfatsion, DCOPFJ (Java): A Free OpenSource Solver for Bid/OfferBased DCOPF ProblemsVersion 1.1
(zipfile,637KB).
Release Date: 6/20/07
Software Description (V1.1)
 As explained in the above
software overview,
DCOPFJ (V1.1) determines daily (24 hour) solution values for augmented DCOPF problems with fixed power demand bids (load profiles) and pricesensitive power supply offers for generation. DCOPFJ (V1.1) includes 3node and 5node test cases that can be used as templates for new case studies. These test cases are dynamic extensions of 3node and 5node test cases frequently used in teaching and training materials.

QuadProgJ is included as a Java archive (Jar) file in the library ("lib") directory extracted from the DCOPFJ (V1.1) zip file. DCOPFJ (V1.1) invokes QuadProgJ only through this Jar file, so separate access to the QuadProgJ source code is not needed. However, for the benefit of users who might wish to use QuadProgJ as a general SCQP solver in other problem contexts, the source code for QuadProgJ is included as a separate directory extractable from the DCOPFJ (V1.1) zip file.
Manuals and Tutorials (V1.1)
 Junjie Sun and Leigh Tesfatsion (2007a), "DC Optimal Power Flow Formulation and Testing Using QuadProgJ"
(pdf,526KB),
ISU Economics Working Paper No. 06014, Department of Economics, Iowa State University, revised October.
 "OpenSource Software for Power Industry Research, Teaching, and Training: A DCOPF Illustration"
(SlideSet,pdf,701KB),
presentation (Leigh Tesfatsion), IEEE Power Engineering Systems General Meeting, Tampa, Florida, June 27, 2007.
DCOPFJVersion 2.0 (Sun and Tesfatsion):
Software Download (V2.0)

Junjie Sun and Leigh Tesfatsion, DCOPFJ (Java): A Free OpenSource Solver for
Bid/OfferBased DCOPF ProblemsVersion 2.0
(zipfile,646KB).
Release Date: 6/20/07
Software Description (V2.0)

DCOPFJ (V2.0) determines daily (24 hour) solution values for augmented DCOPF problems with pricesensitive power demand bids (with or without fixeddemand components) and with pricesensitive power supply offers for generation. This contrasts with DCOPFJ (V1.1), in which all power demand bids are assumed to be fixed (not price sensitive). The handling of pricesensitive power demand bids requires a change in the form of the objective function and the nodal balance constraints for the augmented DCOPF problem treated in DCOPFJ (V1.1).

DCOPFJ (V2.0) includes two test cases that can be used as templates for new case studies. The first test case is a dynamic extension of a 5node test case taken from ISONE/PJM training manuals. The second test case is a dynamic extension of the modified IEEE 30node bus system developed by M. Shahidehpour, H. Yamin, and Z. Li (Market Operations in Electric Power Systems, 2002, Appendix, Section D.4, pp. 477478).

QuadProgJ is included as a Java archive (Jar) file in the library ("lib") directory extracted from the DCOPFJ (V2.0) zip file. DCOPFJ (V2.0) invokes QuadProgJ only through this Jar file, so separate access to the QuadProgJ source code is not needed. However, for the benefit of users who might wish to use QuadProgJ as a general SCQP solver in other problem contexts, the source code for QuadProgJ is included as a separate directory extractable from the DCOPFJ (V2.0) zip file.
Manuals and Tutorials (V2.0)
 Junjie Sun and Leigh Tesfatsion (2007b), "DCOPF Formulation with PriceSensitive Demand Bids"
(pdf,103KB),
Working Paper, Economics Department, Iowa State University, Ames, Iowa.
 Hongyan Li, Junjie Sun, and Leigh Tesfatsion (2008), "Dynamic LMP Response Under Alternative PriceCap and PriceSensitive Demand Scenarios"
(pdf,465KB),
Proceedings, IEEE Power Engineering Society General Meetings, CarnegieMellon University, Pittsburgh, July 2024.
Licensing Terms

The DCOPFJ package is licensed by the copyright holders (Junjie Sun and Leigh Tesfatsion) as free opensource software under the terms of the
GNU General Public License (GPL).
Anyone who is interested is allowed to view,
modify, and/or improve upon the code used to produce this package, but any
software generated using all or part of this code must be released as free opensource
software in turn. The GNU GPL can be viewed in its entirety
here.
Publications and References
 Hongyan Li, Junjie Sun, and Leigh Tesfatsion (2008), "Dynamic LMP Response Under Alternative PriceCap and PriceSensitive Demand Scenarios"
(pdf,465KB),
Proceedings, IEEE Power Engineering Society General Meetings, CarnegieMellon University, Pittsburgh, July 2024.
 Junjie Sun and Leigh Tesfatsion (2007a), "DC Optimal Power Flow Formulation and Testing Using QuadProgJ"
(pdf,526KB),
ISU Economics Working Paper No. 06014, Department of Economics, Iowa State University, Revised October.
 Junjie Sun and Leigh Tesfatsion (2007b), "OpenSource Software for Power Industry Research, Teaching, and Training: A DCOPF Illustration"
(pdf,115KB),
Proceedings, IEEE Power Engineering Systems General Meeting, Tampa, Florida, June.
 Note: This proceedings paper is a brief summary of Sun and Tesfatsion (2007a).
 Junjie Sun and Leigh Tesfatsion (2007c), "DCOPF Formulation with PriceSensitive Demand Bids"
(pdf,103KB),
Working Paper, Economics Department, Iowa State University, Ames, Iowa.
 Junjie Sun and Leigh Tesfatsion (2007d), "Dynamic Testing of Wholesale Power Market Designs: An OpenSource AgentBased Framework", Computational Economics, Volume 30, Number 3, pp. 291327.
 Note: This article is an abridged version of ISU Economics Working Paper No. 06025
(pdf,2.2MB).
 Junjie Sun and Leigh Tesfatsion (2007e), "An AgentBased Computational Laboratory for Wholesale Power Market Design"
(pdf,724KB),
Proceedings, IEEE Power Engineering Systems General Meeting, Tampa, Florida, June.
 Note: This proceedings paper is a brief summary of Sun and Tesfatsion (2007d).
 Donald Goldfarb and Ashok Udhawdas Idnani (1983), "A Numerically Stable Dual Method for Solving Strictly Convex Quadratic Programs", Mathematical Programming, Vo. 27, pp. 133.
 R. D. Zimmerman, C. E. MurilloSanchez, and D. D. Gan (2006),
"MATPOWER  A MATLAB Power System Simulation Package: User's Manual",
Power Systems Engineering Research Center (PSERC), School of Electrical Engineering, Cornell University.
Acknowledgements
 The work reported at this site has been supported in part by Grant NSF0527460 awarded by the National Science Foundation and by grants awarded by the ISU Electric Power Research Center.