9.1 Input/Output Functions
9.1.1 loadcase
The loadcase function provides the canonical way of loading a Matpower case
from a file or struct. It takes as input either a struct or the name of an M-file or
MAT-file in the Matlab path (casefile) and returns a standard Matpower
case struct (mpc). It can also convert from the older version 1 case file format to
the current format. This function allows a case to be loaded, and potentially
modified, before calling one of the main simulation functions such as runpf or
runopf.
9.1.2 savecase
savecase(fname, mpc) savecase(fname, mpc, version) savecase(fname, comment, mpc) savecase(fname, comment, mpc, version) fname = savecase(fname, ...)
The savecase function writes out a Matpower case file, given a name for the file to be
created or overwritten (fname), and a Matpower case struct (mpc). If fname ends
with '.mat' it saves the case as a MAT-file, otherwise it saves it as an M-file.
Optionally returns the filename, with extension added if necessary. The optional
comment argument is either string (single line comment) or a cell array of strings
which are inserted as comments in the help section of the file. If the optional
version argument is '1' it will modify the data matrices to version 1 format before
saving.
9.1.3 cdf2mpc
mpc = cdf2mpc(cdf_file_name) mpc = cdf2mpc(cdf_file_name, verbose) mpc = cdf2mpc(cdf_file_name, mpc_name) mpc = cdf2mpc(cdf_file_name, mpc_name, verbose) [mpc, warnings] = cdf2mpc(cdf_file_name, ...)
The cdf2mpc function converts an IEEE Common Data Format (CDF) data file into a
Matpower case struct. Given an optional file name mpc_name, it can save the converted
case to a Matpower case file. Warnings generated during the conversion process can be
optionally returned in the warnings argument.
Since the IEEE CDF format does not contain all of the data needed to run an optimal
power flow, some data, such as voltage limits, generator limits and generator costs are
created by cdf2mpc. See help cdf2mpc for details.
9.1.4 psse2mpc
mpc = psse2mpc(rawfile_name) mpc = psse2mpc(rawfile_name, verbose) mpc = psse2mpc(rawfile_name, verbose, rev) mpc = psse2mpc(rawfile_name, mpc_name) mpc = psse2mpc(rawfile_name, mpc_name, verbose) mpc = psse2mpc(rawfile_name, mpc_name, verbose, rev) [mpc, warnings] = psse2mpc(rawfile_name, ...)
The psse2mpc function converts a PSS/E RAW data file into a Matpower case struct.
Given an optional file name mpc_name, it can save the converted case to a Matpower case
file. Warnings generated during the conversion process can be optionally returned in the
warnings argument. By default, psse2mpc attempts to determine the revision of the PSS/E
RAW file from the contents, but the user can specify an explicit revision number to use in
the optional rev argument.
9.1.5 save2psse
save2psse(fname, mpc) fname_out = save2psse(fname, mpc)
The save2psse function saves a Matpower case struct mpc as a PSS/E RAW file. The
fname parameter is a string containing the name of the file to be created or overwritten. If
fname does not include a file extension, codeq.raw will be added. Optionally
returns the, possibly updated, filename. Currently exports to RAW format Rev
33.