Get Started with MATPOWER

You can begin using MATPOWER in just a few easy steps. First, install MATLAB or GNU Octave if you don’t already have one of them installed.

1. Get a copy of MATPOWER.

Click the download link on the right for the latest release version, and extract the downloaded ZIP file anywhere you like.

Or see the README for other options.

2. Install MATPOWER

Start MATLAB or Octave and change your working directory to the MATPOWER directory you just extracted (the one containing install_matpower.m).

Run the installer and follow the directions to add the required directories to your MATLAB or Octave path, by typing:

install_matpower

3. That’s it. There is no step 3.

But, if you choose not to have the installer run the test suite for you in step 2, you can run it now to verify that MATPOWER is installed an functioning properly, by typing:

test_matpower

Running MATPOWER

To run a simple Newton power flow on the 9-bus system specified in the file case9.m, with the default algorithm options, at the MATLAB or Octave prompt, type:

runpf('case9')

To load the 30-bus system data from case30.m, increase its real power demand at bus 2 to 30 MW, then run an AC optimal power flow with default options, type:

define_constants;
mpc = loadcase('case30');
mpc.bus(2, PD) = 30;
runopf(mpc);

By default, the results of the simulation are pretty-printed to the screen, but the solution can also be optionally returned in a results struct. The following example shows how simple it is, after running a DC OPF on the 118-bus system in case118.m, to access the final objective function value, the real power output of generator 6 and the power flow in branch 51.

results = rundcopf('case118');
final_objective = results.f;
gen6_output     = results.gen(6, PG);
branch51_flow   = results.branch(51, PF);

For additional info, see the MATPOWER User’s Manual, the on-line function reference, or the built-in help documentation for the various MATPOWER functions. For example:

help runpf
help runopf
help mpoption
help caseformat

The information on this page, and more, can also be found in the README file on GitHub and in your local MATPOWER distribution.

Join a MATPOWER Email List

Join other MATPOWER users to discuss MATPOWER and get help, receive announcements of new versions, or interact with other MATPOWER developers by subscribing to the appropriate e-mail list in the sidebar on the right.