grg-mp2grg package¶
grg_mp2grg.io module¶
functions for reading and writing matpower data files
-
grg_mp2grg.io.
build_cli_parser
()¶
-
grg_mp2grg.io.
build_gen_cost_mp
(index, grg_cost_model, base_mva, float_precision)¶
-
grg_mp2grg.io.
build_gen_cost_mp_default
(index, model_type, degree)¶
-
grg_mp2grg.io.
build_gen_cost_mp_losses
(index, model_type, degree)¶
-
grg_mp2grg.io.
build_mp_case
(grg_data, mapping_ids=None, add_gen_costs=False, add_bus_names=False)¶
-
grg_mp2grg.io.
currents_to_mvas
(currents, from_bus, to_bus)¶
-
grg_mp2grg.io.
main
(args)¶ reads a matpower or grg case file and processes it based on command line arguments.
- Args:
- args: an argparse data structure
-
grg_mp2grg.io.
parse_grg_case_file
(grg_file_name)¶ opens the given path and parses it as json data
- Args:
- grg_file_name(str): path to the a json data file
- Returns:
- Dict: a dictionary case
-
grg_mp2grg.io.
parse_mp_case_file
(mpFileName)¶ opens the given path and parses it as matpower data
- Args:
- mpFileName(str): path to the a matpower data file
- Returns:
- Case: a mpdata case
-
grg_mp2grg.io.
parse_mp_case_lines
(mpLines)¶ parses a list of strings as matpower data
- Args:
- mpLines(list): the list of matpower data strings
- Returns:
- Case: a grg_mp2grg case
-
grg_mp2grg.io.
print_err
()¶ print(value, …, sep=’ ‘, end=’n’, file=sys.stdout)
Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline.
-
grg_mp2grg.io.
test_idempotent
(input_data_file)¶
-
grg_mp2grg.io.
write_json_case_file
(output_file_location, case)¶ writes a grg data json file
- Args:
- output_file_location (str): the path of the file to write case (Case): the data structure to write out
grg_mp2grg.exception module¶
a collection of all grg_mp2grg exception classes
-
exception
grg_mp2grg.exception.
MP2GRGWarning
¶ Bases:
exceptions.Warning
root class for all MP2GRG Warnings
grg_mp2grg.struct module¶
extensions to data structures for encoding matpower data files to support grg data encoding
-
class
grg_mp2grg.struct.
Branch
(index, f_bus, t_bus, br_r, br_x, br_b=0.0, rate_a=0.0, rate_b=0.0, rate_c=0.0, tap=0.0, shift=0.0, br_status=1, angmin=-360.0, angmax=360.0, pf=None, qf=None, pt=None, qt=None, mu_sf=None, mu_st=None, mu_angmin=None, mu_angmax=None)¶ Bases:
grg_mpdata.struct.Branch
-
get_grg_operations
(lookup)¶
-
get_grg_setpoint
(base_mva)¶ Returns: a grg data power flow set point as a dictionary
-
get_grg_status
()¶ Returns: a grg data status assignment as a dictionary
-
get_grg_tap_changer_setpoint
(lookup)¶
-
is_transformer
()¶
-
to_grg_line
(lookup, base_mva, omit_subtype=False)¶ Returns: a grg data line name and data as a dictionary
-
-
class
grg_mp2grg.struct.
Bus
(bus_i, bus_type, pd, qd, gs, bs, area, vm, va, base_kv, zone, vmax, vmin, lam_p=None, lam_q=None, mu_vmax=None, mu_vmin=None)¶ Bases:
grg_mpdata.struct.Bus
-
get_grg_bus_setpoint
(lookup)¶ Returns: a grg data voltage set point as a dictionary
-
get_grg_load_setpoint
(lookup, base_mva)¶
-
get_grg_status
()¶ Returns: a grg data status assignment as a dictionary
-
has_load
()¶
-
has_shunt
()¶
-
to_grg_bus
(lookup, omit_subtype=False)¶ Returns: a grg data bus name and data as a dictionary
-
to_grg_load
(lookup, base_mva, omit_subtype=False)¶ Returns: a grg data load name and data as a dictionary
-
to_grg_shunt
(lookup, base_mva, omit_subtype=False)¶ Returns: a grg data shunt name and data as a dictionary
-
-
class
grg_mp2grg.struct.
Case
(name=None, version=None, baseMVA=None, bus=None, gen=None, branch=None, gencost=None, dcline=None, dclinecost=None, busname=None)¶ Bases:
grg_mpdata.struct.Case
-
to_grg
(omit_subtype=False, skip_validation=False)¶ Returns: an encoding of this data structure as a grg data dictionary
-
-
class
grg_mp2grg.struct.
DCLine
(index, f_bus, t_bus, br_status, pf, pt, qf, qt, vf, vt, pmin, pmax, qminf, qmaxf, qmint, qmaxt, loss0, loss1, mu_pmin=None, mu_pmax=None, mu_qminf=None, mu_qmaxf=None, mu_qmint=None, mu_qmaxt=None)¶ Bases:
grg_mpdata.struct.DCLine
-
get_grg_setpoint
(lookup, base_mva)¶ Returns: a grg data power flow set point as a dictionary
-
get_grg_status
()¶ Returns: a grg data status assignment as a dictionary
-
to_grg_dcline
(lookup, base_mva, omit_subtype=False)¶ Returns: a grg data dc line name and data as a dictionary
-
-
class
grg_mp2grg.struct.
Generator
(index, gen_bus, pg, qg, qmax, qmin, vg, mbase, gen_status, pmax, pmin, pc1=0, pc2=0, qc1min=0, qc1max=0, qc2min=0, qc2max=0, ramp_agc=0, ramp_10=0, ramp_30=0, ramp_q=0, apf=0, mu_pmax=None, mu_pmin=None, mu_qmax=None, mu_qmin=None)¶ Bases:
grg_mpdata.struct.Generator
-
get_grg_setpoint
(lookup, base_mva)¶ Returns: a grg data power output set point as a dictionary
-
get_grg_status
()¶ Returns: a grg data status assignment as a dictionary
-
is_synchronous_condenser
()¶
-
to_grg_generator
(lookup, base_mva, omit_subtype=False)¶ Returns: a grg data gen name and data as a dictionary
-
Module contents¶
a package for converting matpower data files to grg data files