PYPOWER provides two primary CLI tools: pf for power flow and opf for Optimal Power Flow (OPF). After installation, these commands are added to your system path.
Basic Usage
To run a power flow on a specific case data file:
$ pf [options] [casedata]
To run an OPF:
$ opf [options] [casedata]
Running Built-in Test Cases
You can run any of the built-in test cases using the -c or --testcase flag.
Available test cases:
case30_userfcns, case118, case9, case30Q, case30pwl, case6ww, case57, case39, case14, case9Q, case30, case300, case4gs, case24_ieee_rts.
Example (running IEEE 14 bus test case):
$ pf -c case14
Example (running OPF for IEEE RTS and saving the result):
$ opf -c case24_ieee_rts --solvedcase=rtsout.py
Saving Results
Use the --solvedcase=SOLVEDCASE option to write the solved case to a file.
- If the filename ends in
.mat, it is saved as a MAT-file. - Otherwise, it is saved as a Python file.
# Run power flow on a specific file
$ pf /path/to/case14.py
# Run OPF on a test case and save output
$ opf -c case24_ieee_rts --solvedcase=rtsout.py