Writers#
- save_case(case, path, **write_params)#
Write a case in the format selected by its file-name suffix.
.rawwrites RAW..rawxand.jsonwrite RAWX. MATPOWER output is unsupported.Every write parameter beyond the path belongs to the chosen format, and the format decides which ones it reads.
versionselects the output revision for a format that has revisions;None, the default, selects the lowest revision that preserves all populated record families. RAW also reads its layout parameters, such asemit_column_headers. A parameter the chosen format does not read is refused and the message names the ones it does.- Parameters:
case -- Case to write.
path -- Destination path.
write_params -- Write parameters for the format the suffix selects.
- Raises:
ValueError -- If the file suffix is not supported, or a write parameter or its value is not one the chosen format reads.
OSError -- If the file cannot be written.
Examples
>>> save_case(case, "grid.raw", version=34) >>> save_case(case, "grid.raw", emit_column_headers=False)
- write_raw(case, path, version=None, *, emit_system_wide=True, emit_column_headers=True, default_rating_labels=('RATE1', 'RATE2', 'RATE3', 'RATE4', 'RATE5', 'RATE6', 'RATE7', 'RATE8', 'RATE9', 'RATE10', 'RATE11', 'RATE12'))#
Write a GpfCase to a RAW file.
version=Nonederives a revision that preserves every populated record family. An explicit version is used as given. The layout parameters apply to revision 34 and later.- Parameters:
case -- Case to write.
path -- Destination path.
version -- Output revision, 33 through 36.
emit_system_wide -- Write the preamble block before the bus data. When false the writer emits only the terminator line.
emit_column_headers -- Write an
@! NAME1, NAME2, ...comment line before each single-line section's data rows.default_rating_labels -- The canonical rating labels. The writer omits a
RATING n, labelline whose label equals its default.
- write_rawx(case, path, version=None)#
Write a GpfCase to a RAWX (JSON) file.
version=None(the default) derives the revision from the case so an unspecified write never silently drops a populated family; an explicit version is honored.
- write_seq(case, path)#
Serialize the case's sequence block to a
.seqfile. The output is always a complete initial-input file (change code 0).
- write_iec(case, path)#
Serialize the case's standard-method supplemental records to a
.iecfile (current file identification).