write#
- ams.io.matpower.write(system, outfile: str, overwrite: bool = None) bool[source]#
Export an AMS system to a MATPOWER M-file.
This function converts an AMS system object into a MATPOWER-compatible mpc dictionary and writes it to a specified output file in MATPOWER format.
- Parameters:
- systemams.system.System
A loaded system.
- outfilestr
Path to the output file.
- overwritebool, optional
None to prompt for overwrite selection; True to overwrite; False to not overwrite.
- Returns:
- bool
True if the file was successfully written, False otherwise.
Notes
In the gen section, slack generators are listed before PV generators.
For uncontrolled generators (ctrl.v == 0), their max and min power limits are set to their initial power (p0.v) in the converted MPC.
In the converted MPC, the indices of area (bus[:, 6]) and zone (bus[:, 10]) may differ from the original MPC. However, the mapping relationship is preserved. For example, if the original MPC numbers areas starting from 1, the converted MPC may number them starting from 0.
The coefficients c2 and c1 in the generator cost data are scaled by baseMVA.
Unlike the XLSX and JSON converters, this implementation uses value providers (v) instead of vin. As a result, any changes made through model.set will be reflected in the generated MPC.
Added in version 1.0.10.