VeraGridEngine.DataStructures package

Submodules

VeraGridEngine.DataStructures.active_branch_data module

class VeraGridEngine.DataStructures.active_branch_data.ActiveBranchData(nelm: int, nbus: int)[source]

Bases: object

ControllableBranchData

property any_pf_control
Returns:

copy() ActiveBranchData[source]
Returns:

remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]]) None[source]

Remapping of the branch-controlled bus indices. :param bus_map_arr: array of old-to-new buses

size() int[source]

Get size of the structure :return:

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) ActiveBranchData[source]

Slice branch data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: array of bus indices to re index main to island indices :param logger: Logger (optional) :return: new BranchData instance

property tap: ndarray[tuple[Any, ...], dtype[complex128]]
Returns:

VeraGridEngine.DataStructures.battery_data module

class VeraGridEngine.DataStructures.battery_data.BatteryData(nelm: int, nbus: int)[source]

Bases: GeneratorData

Structure to host the battery compiled data

copy() BatteryData[source]

Get a deep copy of this object :return: new BatteryData instance

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]]) BatteryData[source]

Slice battery data by given indices :param elm_idx: array of element indices :param bus_idx: array of bus indices :param bus_map: map from bus to index :return: new BatteryData instance

VeraGridEngine.DataStructures.branch_parent_data module

class VeraGridEngine.DataStructures.branch_parent_data.BranchParentData(nelm: int, nbus: int)[source]

Bases: object

Structure to host all branches data for calculation

property C: csc_matrix

Branch-bus connectivity matrix :return:

property Cf: csc_matrix

Bras-bus from connectivity :return:

property Ct: csc_matrix

Bras-bus to connectivity :return:

copy() BranchParentData[source]

Get a deep copy of this object :return: new BranchData instance

get_3ph_names()[source]
get_ac_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get ac branch indices :return:

get_contingency_enabled_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get contingency branch indices :return:

get_dc_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get dc branch indices :return:

get_inter_areas(bus_idx_from: ndarray[tuple[Any, ...], dtype[int64]] | Set[int], bus_idx_to: ndarray[tuple[Any, ...], dtype[int64]] | Set[int])[source]

Get the Branches that join two areas :param bus_idx_from: Area from :param bus_idx_to: Area to :return: List of (branch index, flow sense w.r.t the area exchange)

get_monitor_enabled_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get monitored branch indices :return:

monitored_Cf(idx) csc_matrix[source]

Bras-bus from connectivity for monitored branches :param idx: Monitored branches ids :return:

monitored_Ct(idx) csc_matrix[source]

Bras-bus to connectivity for monitored branches :param idx: Monitored branches ids :return:

remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]

Remapping of the branch buses :param bus_map_arr: array of old-to-new buses

size() int[source]

Get size of the structure :return:

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) Tuple[BranchParentData, ndarray[tuple[Any, ...], dtype[int64]]][source]

Slice branch data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to island bus index {int(o): i for i, o in enumerate(bus_idx)} :param logger: Logger :return: new BranchData instance

to_df() DataFrame[source]

Create DataFrame with the compiled Branches information :return: Pandas DataFrame

VeraGridEngine.DataStructures.bus_data module

class VeraGridEngine.DataStructures.bus_data.BusData[source]

Bases: object

copy() BusData[source]

Deep copy of this structure :return: instance of BusData

get_3ph_names()[source]

Get the 3-phase names :return:

get_idtag_dict() Dict[str, int][source]

Get dictionary of bus idtagd related to the island bus index :return:

get_original_to_island_bus_dict() Dict[int, int][source]

Dictionary that relates the original bus index to the island bus index :return: dict[original idx] -> island index

propagate_controls(chosen_idx: int, other_idx: ndarray[tuple[Any, ...], dtype[int64]]) None[source]

Propagate the strongest control status of the reduced buses into chosen_idx.

set_bus_mode(idx: int, val: BusMode)[source]

Set bus mode :param idx: int :param val: BusMode

size() int[source]

Get size of the structure :return:

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]]) BusData[source]

Slice this data structure :param elm_idx: array of bus indices :return: instance of BusData

VeraGridEngine.DataStructures.bus_data.propagate_controls(chosen_idx: int, other_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_types: ndarray[tuple[Any, ...], dtype[int64]], Vbus: ndarray[tuple[Any, ...], dtype[complex128]], is_p_controlled: ndarray[tuple[Any, ...], dtype[bool]], is_q_controlled: ndarray[tuple[Any, ...], dtype[bool]], is_vm_controlled: ndarray[tuple[Any, ...], dtype[bool]], is_va_controlled: ndarray[tuple[Any, ...], dtype[bool]]) None[source]

Propagate the strongest control status of a reduced bus cluster to the surviving bus.

The donor bus is chosen from chosen_idx and other_idx using the actual control flags, not only the bus type, so VSC/HVDC-added controls are preserved as well. :param chosen_idx: island of the island chosen by the topological reduction process to represent the reduction set :param other_idx: rest of buses in the set that are going to be reduced but may contain important information :param bus_types: :param Vbus: :param is_p_controlled: :param is_q_controlled: :param is_vm_controlled: :param is_va_controlled: :return:

VeraGridEngine.DataStructures.fluid_node_data module

class VeraGridEngine.DataStructures.fluid_node_data.FluidNodeData[source]

Bases: object

copy() FluidNodeData[source]

Get deep copy of this structure :return: new FluidNodeData instance

size() int[source]

Get size of the structure :return:

VeraGridEngine.DataStructures.fluid_p2x_data module

class VeraGridEngine.DataStructures.fluid_p2x_data.FluidP2XData[source]

Bases: FluidTurbineData

copy() FluidP2XData[source]

Get deep copy of this structure :return: new FluidP2XData instance

VeraGridEngine.DataStructures.fluid_path_data module

class VeraGridEngine.DataStructures.fluid_path_data.FluidPathData[source]

Bases: object

copy() FluidPathData[source]

Get deep copy of this structure :return: new FluidPathData instance

size() int[source]

Get size of the structure :return:

VeraGridEngine.DataStructures.fluid_pump_data module

class VeraGridEngine.DataStructures.fluid_pump_data.FluidPumpData[source]

Bases: FluidTurbineData

copy() FluidPumpData[source]

Get deep copy of this structure :return: new FluidPumpData instance

VeraGridEngine.DataStructures.fluid_turbine_data module

class VeraGridEngine.DataStructures.fluid_turbine_data.FluidTurbineData[source]

Bases: object

copy() FluidTurbineData[source]

Get deep copy of this structure :return: new FluidTurbineData instance

size() int[source]

Get size of the structure :return:

VeraGridEngine.DataStructures.generator_data module

class VeraGridEngine.DataStructures.generator_data.GeneratorData[source]

Bases: object

copy()[source]

Get a deep copy of this object :return: new GeneratorData instance

dev_per_bus() ndarray[tuple[Any, ...], dtype[int64]][source]

Get number of devices per bus :return: array with the number of elements per bus

get_C_bus_elm() csc_matrix[source]

Get the connectivity matrix :return: CSC matrix

get_Yshunt(seq: int = 1) ndarray[tuple[Any, ...], dtype[complex128]][source]

Obtain the vector of shunt admittances of a given sequence per bus :param seq: sequence (0, 1 or 2)

get_array_per_bus(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator array per bus :param arr: :return:

get_array_per_bus_obj(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]

Sum per bus in python mode (it can add objects) :param arr: any array of size nelm :return: array of size nbus

get_bus_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get the bus indices :return: array with the bus indices

get_controllable_and_not_controllable_indices() Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]

Get the indices of controllable generators :return: idx_controllable, idx_non_controllable

get_dispatchable_active_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get the indices of dispatchable generators :return:

get_dispatchable_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get the indices of dispatchable generators :return:

get_dispatchable_per_bus() ndarray[tuple[Any, ...], dtype[bool]][source]

Get generator Injections per bus :return:

get_effective_generation() ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator effective power :return:

get_gen_indices_at_buses(bus_indices: ndarray[tuple[Any, ...], dtype[int64]]) ndarray[tuple[Any, ...], dtype[int64]][source]
get_injections() ndarray[tuple[Any, ...], dtype[complex128]][source]

Compute the active and reactive power of non-controlled generators (assuming all) :return:

get_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get generator Injections per bus :return:

get_installed_power_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator installed power per bus :return:

get_non_dispatchable_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get the indices of dispatchable generators :return:

get_pf() ndarray[tuple[Any, ...], dtype[float64]][source]

Get the array of power factors :return:

get_pmax_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator Pmax per bus :return:

get_pmin_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator Pmin per bus :return:

get_q_at(i) float[source]
Parameters:

i

Returns:

get_qmax_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator Qmax per bus :return:

get_qmin_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator Qmin per bus :return:

remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]

Remapping of the elm buses :param bus_map_arr: array of old-to-new buses

size() int[source]

Get size of the structure :return:

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]])[source]

Slice generator data by given indices :param elm_idx: array of element indices :param bus_idx: array of bus indices :param bus_map: map from bus index to element index :return: new GeneratorData instance

VeraGridEngine.DataStructures.hvdc_data module

class VeraGridEngine.DataStructures.hvdc_data.HvdcData[source]

Bases: BranchParentData

copy() HvdcData[source]

Make a deep copy of this structure :return: new HvdcData instance

get_angle_droop_in_pu_rad(Sbase: float)[source]

Get the angle droop in pu/rad :param Sbase: base power :return:

get_angle_droop_in_pu_rad_at(i: int, Sbase: float)[source]

Get the angle droop in pu/rad :param i: index :param Sbase: base power :return:

get_bus_indices_f() ndarray[tuple[Any, ...], dtype[int64]][source]

Get bus indices β€œfrom” :return:

get_bus_indices_t() ndarray[tuple[Any, ...], dtype[int64]][source]

Get bus indices β€œto” :return:

get_inter_areas(bus_idx_from: ndarray[tuple[Any, ...], dtype[int64]] | Set[int], bus_idx_to: ndarray[tuple[Any, ...], dtype[int64]] | Set[int])[source]

Get the hvdcs that join two areas :param bus_idx_from: Area from :param bus_idx_to: Area to :return: List of (branch index, flow sense w.r.t the area exchange)

get_power(Sbase: float, theta: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], int][source]

Get hvdc power :param Sbase: base power :param theta: bus angles array :return: Pbus, Losses, Pf, Pt, loading, nfree

get_qmax_from_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Max reactive power in the From Bus :return: (nbus, nt) Qmax From

get_qmax_to_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Max reactive power in the To Bus :return: (nbus, nt) Qmax To

get_qmin_from_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Min reactive power in the From Bus :return: (nbus, nt) Qmin From

get_qmin_to_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Min reactive power in the To Bus :return: (nbus, nt) Qmin To

remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]

Remapping of the branch buses :param bus_map_arr: array of old-to-new buses

size() int[source]

Get size of the structure :return:

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) HvdcData[source]

Make a deep copy of this structure :return: new HvdcData instance

VeraGridEngine.DataStructures.load_data module

class VeraGridEngine.DataStructures.load_data.LoadData(nelm: int, nbus: int)[source]

Bases: object

Structure to host the load calculation information

copy() LoadData[source]

Get a deep copy of this structure :return: new LoadData instance

get_admittance_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get admittance Injections per bus with sign :return:

get_array_per_bus(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator array per bus :param arr: :return:

get_array_per_bus_obj(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]

Sum per bus in python mode (it can add objects) :param arr: any array of size nelm :return: array of size nbus

get_bus_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get the bus indices :return: array with the bus indices

get_current_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get current Injections per bus with sign :return:

get_effective_load() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get effective load :return:

get_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get Injections per bus with sign :return:

get_linear_effective_load() ndarray[tuple[Any, ...], dtype[float64]][source]

Get effective load :return:

get_linear_injections_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Get Injections per bus with sign :return:

remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]

Remapping of the elm buses :param bus_map_arr: array of old-to-new buses

size() int[source]

Get size of the structure :return:

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]]) LoadData[source]

Slice load data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to island bus index {int(o): i for i, o in enumerate(bus_idx)} :return: new LoadData instance

VeraGridEngine.DataStructures.numerical_circuit module

class VeraGridEngine.DataStructures.numerical_circuit.DataStructType(value)[source]

Bases: Enum

BATTERYDATA = 5
BRANCHDATA = 2
BUSDATA = 1
GENERATORDATA = 4
HVDCDATA = 3
LOADDATA = 6
NOSTRUCT = 0
SHUNTDATA = 7
VSCDATA = 8
class VeraGridEngine.DataStructures.numerical_circuit.NumericalCircuit(nbus: int, nbr: int, nhvdc: int, nvsc: int, nload: int, ngen: int, nbatt: int, nshunt: int, nfluidnode: int, nfluidturbine: int, nfluidpump: int, nfluidp2x: int, nfluidpath: int, sbase: float, t_idx: int | None = None)[source]

Bases: object

Class storing the calculation information of the devices

Sbase: float
active_branch_data: ActiveBranchData
battery_data: BatteryData
bus_data: BusData
compare(nc_2: NumericalCircuit, tol=1e-06) Tuple[bool, Logger][source]

Compare this numerical circuit with another numerical circuit :param nc_2: other NumericalCircuit :param tol: tolerance for numerical values :return: all ok?, Logger with the errors and warning events

compute_adjacency_matrix(consider_hvdc_as_island_links: bool = False) csc_matrix[source]

Compute the adjacency matrix :param consider_hvdc_as_island_links: Does the HVDCLine works for the topology as a normal line? :return: csc_matrix

consolidate_information() None[source]

Consolidates the information of this object

copy() NumericalCircuit[source]

Deep copy of ths object :return: NumericalCircuit instance

fluid_node_data: FluidNodeData
fluid_p2x_data: FluidP2XData
fluid_path_data: FluidPathData
fluid_pump_data: FluidPumpData
fluid_turbine_data: FluidTurbineData
generator_data: GeneratorData
get_Yshunt_bus_pu() ndarray[tuple[Any, ...], dtype[complex128]][source]
Returns:

get_admittance_injections_pu() ndarray[tuple[Any, ...], dtype[complex128]][source]
Returns:

get_admittance_matrices() AdmittanceMatrices[source]

Get Admittance structures :return: Admittance object

get_connectivity_matrices() ConnectivityMatrices[source]

Get connectivity matrices :return:

get_current_injections_pu() ndarray[tuple[Any, ...], dtype[complex128]][source]
Returns:

get_fast_decoupled_amittances() FastDecoupledAdmittanceMatrices[source]
Returns:

get_island(bus_idx: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None = None) NumericalCircuit[source]

Get the island corresponding to the given buses :param bus_idx: array of bus indices :param logger: Logger :return: NumericalCircuit

get_linear_admittance_matrices(indices: SimulationIndices | None = None) LinearAdmittanceMatrices[source]

Get the linear admittances :return:LinearAdmittanceMatrices

get_power_injections() ndarray[tuple[Any, ...], dtype[complex128]][source]

Compute the power :return: return the array of power Injections in MW if normalized is false, in p.u. otherwise

get_power_injections_pu() ndarray[tuple[Any, ...], dtype[complex128]][source]

Compute the power :return: return the array of power Injections in MW if normalized is false, in p.u. otherwise

get_reactive_power_limits() Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

compute the reactive power limits in place :return: Qmax_bus, Qmin_bus in per unit

get_reduction_bus_mapping() ndarray[tuple[Any, ...], dtype[int64]][source]

Get array is used to keep track of the bus topological reduction :return: IntVec

get_series_admittance_matrices() SeriesAdmittanceMatrices[source]
Returns:

get_simulation_indices(Sbus: ndarray[tuple[Any, ...], dtype[complex128]] | None = None, bus_types: ndarray[tuple[Any, ...], dtype[int64]] | None = None, force_only_pq_pv_vd_types=False) SimulationIndices[source]

Get the simulation indices :param Sbus: Array of bus powers (optional) :param bus_types: different array of bus_types (optional) :param force_only_pq_pv_vd_types: if true, all bus types are forced into PQ PV or VD,

for certain types of simulations that cannot handle other bus types

Returns:

SimulationIndices

get_structural_ntc(bus_a1_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_a2_idx: ndarray[tuple[Any, ...], dtype[int64]]) float[source]

Get the structural NTC :param bus_a1_idx: array of bus indices of the area from :param bus_a2_idx: array of bus indices of the area to :return: structural NTC in MVA

hvdc_data: HvdcData
init_idtags_dict()[source]

Initialize the internal structure for idtags querying :return:

is_dc() Tuple[int, str][source]

Check if this island is DC :return: int, str -> 1: all DC, 0: all AC, 2: AC and DC

load_data: LoadData
nbatt: int
nbr: int
nbus: int
nfluidnode: int
nfluidp2x: int
nfluidpath: int
nfluidpump: int
nfluidturbine: int
ngen: int
nhvdc: int
nload: int
nshunt: int
nvsc: int
passive_branch_data: PassiveBranchData
process_reducible_branches() int[source]

Process the reducible branches (i.e. reduce branches like the switches) in-place :return: Number of reduced branches

propagate_bus_result(bus_magnitude: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]])[source]

This function applies the __bus_map_arr to a calculated magnitude to propagate the calculated nodal result :param bus_magnitude: some array of the size of buses (all) :return: propagated results

propagate_bus_result_mat(bus_magnitude: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[int, int], dtype[float64]] | ndarray[tuple[Any, ...], dtype[complex128]])[source]

This function applies the __bus_map_arr to a calculated magnitude to propagate the calculated nodal result :param bus_magnitude: some array of the size of buses (all) :return: propagated results

query_idtag(idtag: str) Tuple[DataStructType, int][source]

Query the structure and index where an idtag exists :param idtag: idtag :return: DataStructType, integer position

set_con_or_ra_status(event_list: List[Contingency | RemedialAction], revert: bool = False) ndarray[tuple[Any, ...], dtype[float64]][source]

Set the status of a list of contingencies or remedial actions :param event_list: list of contingencies and or remedial actions :param revert: if false, the contingencies are applied, else they are reversed :return: vector of power injection increments

set_investments_status(investments_list: List[Investment], status: int) None[source]

Set the status of a list of investments :param investments_list: list of investments :param status: status to set in the internal structures

shunt_data: ShuntData
split_into_islands(ignore_single_node_islands: bool = False, consider_hvdc_as_island_links: bool = False, logger: Logger | None = None) List[NumericalCircuit][source]

Split circuit into islands :param ignore_single_node_islands: ignore islands composed of only one bus :param consider_hvdc_as_island_links: Does the HVDCLine works for the topology as a normal line? :param logger: Logger :return: List[NumericCircuit]

structs_idtag_dict: Dict[str, Tuple[DataStructType, int]]
t_idx: int | None
property topology_performed: bool

Flag indicating if topology processing happened here :return:

vsc_data: VscData
VeraGridEngine.DataStructures.numerical_circuit.build_q_limits(nbus: int, Sbase: float, gen_idx, q_min_gen, q_max_gen, active_gen, control_mode_int_gen, batt_idx, q_min_batt, q_max_batt, active_batt, control_mode_int_batt, sh_idx, q_min_sh, q_max_sh, active_sh, control_mode_int_sh, hvdc_f, hvdc_t, q_min_hvdc_f, q_max_hvdc_f, q_min_hvdc_t, q_max_hvdc_t, active_hvdc, v_ctrl_val_gen: int, v_ctrl_val_sh: int)[source]
Parameters:
  • nbus

  • Sbase

  • gen_idx

  • q_min_gen

  • q_max_gen

  • active_gen

  • control_mode_int_gen

  • batt_idx

  • q_min_batt

  • q_max_batt

  • active_batt

  • control_mode_int_batt

  • sh_idx

  • q_min_sh

  • q_max_sh

  • active_sh

  • control_mode_int_sh

  • hvdc_f

  • hvdc_t

  • q_min_hvdc_f

  • q_max_hvdc_f

  • q_min_hvdc_t

  • q_max_hvdc_t

  • active_hvdc

  • v_ctrl_val_gen

:param v_ctrl_val_sh :return:

VeraGridEngine.DataStructures.numerical_circuit.check_arr(arr: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[int64]] | ndarray[tuple[Any, ...], dtype[bool]] | ndarray[tuple[Any, ...], dtype[complex128]], arr_expected: ndarray[tuple[Any, ...], dtype[float64]] | ndarray[tuple[Any, ...], dtype[int64]] | ndarray[tuple[Any, ...], dtype[bool]] | ndarray[tuple[Any, ...], dtype[complex128]], tol: float, name: str, test: str, logger: Logger) int[source]
Parameters:
  • arr

  • arr_expected

  • tol

  • name

  • test

  • logger

Returns:

VeraGridEngine.DataStructures.numerical_circuit.correct_bus_types(gen_idx: ndarray[tuple[Any, ...], dtype[int64]], control_mode_int: ndarray[tuple[Any, ...], dtype[int64]], gen_controllable_bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_types: ndarray[tuple[Any, ...], dtype[int64]], v_ctrl_val: int)[source]

Function to Correct bus types because of generators moving around due to the topology processing :param gen_idx: :param control_mode_int: :param gen_controllable_bus_idx: :param bus_types: :param v_ctrl_val: value for GeneratorControlMode.V :return:

VeraGridEngine.DataStructures.passive_branch_data module

class VeraGridEngine.DataStructures.passive_branch_data.PassiveBranchData(nelm: int, nbus: int)[source]

Bases: BranchParentData

Structure to host all branches data for calculation

copy() PassiveBranchData[source]

Get a deep copy of this object :return: new BranchData instance

detect_superconductor_at(k) None[source]

There is a beyond terrible practice of setting branches with R=0 and X=0 as β€œsuperconductor”…. Those must be reduced of course :param k: index

get_series_admittance() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get the series admittance of the branches :return: complex vector

size() int[source]

Get size of the structure :return:

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) PassiveBranchData[source]

Slice branch data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to island bus index {int(o): i for i, o in enumerate(bus_idx)} :param logger: Logger :return: new BranchData instance

VeraGridEngine.DataStructures.shunt_data module

class VeraGridEngine.DataStructures.shunt_data.ShuntData[source]

Bases: object

copy() ShuntData[source]

Get deep copy of this structure :return: new ShuntData instance

get_C_bus_elm() csc_matrix[source]

Get the connectivity matrix :return: CSC matrix

get_array_per_bus(arr: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator array per bus :param arr: :return:

get_bus_indices() ndarray[tuple[Any, ...], dtype[int64]][source]

Get the bus indices :return: array with the bus indices

get_controllable_and_not_controllable_indices() Tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray[tuple[Any, ...], dtype[int64]]][source]

Get the indices of controllable generators :return: idx_controllable, idx_non_controllable

get_fix_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get fixed Injections per bus :return:

get_injections_per_bus() ndarray[tuple[Any, ...], dtype[complex128]][source]

Get Injections per bus :return:

get_qmax_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator Qmax per bus :return:

get_qmin_per_bus() ndarray[tuple[Any, ...], dtype[float64]][source]

Get generator Qmin per bus :return:

remap(bus_map_arr: ndarray[tuple[Any, ...], dtype[int64]])[source]

Remapping of the elm buses :param bus_map_arr: array of old-to-new buses

size() int[source]

Get size of the structure :return:

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]]) ShuntData[source]

Slice shunt data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to branch index :return: new ShuntData instance

VeraGridEngine.DataStructures.vsc_data module

class VeraGridEngine.DataStructures.vsc_data.VscData(nelm: int, nbus: int)[source]

Bases: BranchParentData

VscData class provides a structured model for managing data related to Voltage Source Converters (VSC) in power grid simulations.

copy() VscData[source]

Get a deep copy of this object :return: new BranchData instance

slice(elm_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_idx: ndarray[tuple[Any, ...], dtype[int64]], bus_map: ndarray[tuple[Any, ...], dtype[int64]], logger: Logger | None) VscData[source]

Slice branch data by given indices :param elm_idx: array of branch indices :param bus_idx: array of bus indices :param bus_map: map from bus index to branch index :param logger: Logger :return: new BranchData instance

Module contents